Forum und email

GtkEditable::delete_text

void delete_text(int start_pos, int end_pos);

Deletes a sequence of characters. The characters that are deleted are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the the characters deleted will be those characters from start_pos to the end of the text.

例 50. Deleting all text from an entry


$editable->delete_text(0, -1);

     

例 51. Deleting all selected text from the editable


$bounds = $editable->get_selection_bounds();
if ($bounds !== false) {
    $editable->delete_text($bounds[0], $bounds[1]);
}

     

参照: delete_selection()