Re: initial keyboard focus, tabbing and keyboard accelerators [message #41446 is a reply to message #41202] |
Tue, 19 October 2004 12:25   |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
David Fanning wrote:
> Benjamin Hornberger writes:
>
>>1. When I tab into a text field which already has something written in
>> it, I would like the existing text to be highlighted already, so that I
>> can just overwrite it.
>
>
> When you get a keyboard focus event in your text widget (you
> set it up to do so, right?), then use the SET_TEXT_SELECT
> keyword with WIDGET_CONTROL to select whatever text is there.
>
> If you compile fsc_field.pro you will find an example program
> at the bottom. Run that and tab between the three text fields
> to see what I mean.
Actually I ran into some trouble with that today. In a popup window, I
want to give the initial keyboard focus to an fsc_field widget. As David
recommended, to mark the existing text I set up keyboard focus events on
the fsc_field (actually the fsc_field's text field, whose ID I get via
fsc_field_object -> GetTextID()). But then I got an error message from
FSC_Field::TextEvents, because it seems not to be prepared for keyboard
focus events ("type" is not a valid field for keyboard focus event
structures, and FSC_Field::TextEvents uses the event.type field right
away). I got around by inserting
IF tag_names(event, /structure_name) EQ 'WIDGET_KBRD_FOCUS' THEN BEGIN
event.id = self.tlb
return, event
ENDIF
at the beginning of FSC_FIELD::TextEvents. This will redirect the
keyboard focus event to the fsc_field's event handler. Maybe there is a
more elegant solution, but this solved the problem for me without
reading the whole code ;-). David, maybe you want to include something
like that into fsc_field?
>
>
>> 3. Similarly, I would like text fields (like cw_field or David's
>> fsc_field) where I can have one letter in the label underlined. If "Alt"
>> plus that letter are pressed, the keyboard focus should jump into the
>> text field, and the existing text should be highlighted. This actually
>> applies in a similar fashion to all widgets which have a label, like
>> sliders, droplists etc.
>
>
> With the exception of the underlined letter, I think this functionality
> can be implemented now. I agree, an underlined letter would be nice,
> and make it in color too, as long as you have the code opened up. :-)
>
I am not sure how I can implement that currently. widget_control,
/input_focus applies only to buttons, draw and text widgets. How can I
give the keyboard focus to a list, droplist, slider or other widget
besides tabbing onto them?
Thanks for any help or comments,
Benjamin
|
|
|