Hello
I am actually writing a notepad in Win32::GUI for learning.
I have add 2 methods in GUI.pm in the WIN32::GUI::TEXTFIELD package.
I need those methods for my Edit menu.
Laurent.
###########################################################################
# (@)METHOD:CanUndo()
# Can undo last modification in the Textfield.
# return a boolean value
sub CanUndo {
my($self, $wparam, $lparam) = @_;
# 0x00C6 == EM_CANUNDO
return Win32::GUI::SendMessage($self, 0x00C6, 0, 0);
}
###########################################################################
# (@)METHOD:Selected()
# Get the range of selected characters in the Textfield.
# if called in a list context
# return a boolean value to indicate if a selection exist
# if called in a list context
# return a list with start and end of the selection
# if no selection Then return an empty list
sub Selected {
my $self = shift;
my $result;
# 176 == EM_GETSEL
$result = Win32::GUI::SendMessage($self, 176, 0, 0);
if (wantarray) {
return $result != 0 ? ( $result & 0x00FF, $result >> 16) : ();
}
else {
return $result;
}
}