For some reason, this (found herehere) works. However, I still haven't managed to adapt it to do what I want to do. Therefore, this answers only partially my question.
<select id="<?php echo $this->get_field_id('posttype'); ?>" name="<?php echo $this->get_field_name('posttype'); ?>" class="widefat" style="width:100%;">
<?php foreach(get_post_types($getposttype_args,'names') as $post_type) { ?>
<option <?php selected( $instance['posttype'], $post_type ); ?> value="<?php echo $post_type; ?>"><?php echo $post_type; ?></option>
<?php } ?>
</select>