[lazarus] Programmatically showing the listbox of combobox

Jesus Reyes jesusrmx at yahoo.com.mx
Tue Jun 10 23:54:05 EDT 2003



----- Original Message -----
From: <hernan.et at pg.com>
To: <lazarus at miraclec.com>
Sent: Tuesday, June 10, 2003 7:24 PM
Subject: Re: [lazarus] Programmatically showing the listbox of combobox


> Hi Jesus,
>
> >Hi, I have noticed that sometimes (for example when clicking out of
> >the listbox) the DroppedDown property doesnt get updated. Also it
> >seems that the listbox doesnt get the keyboard focus when pop up.
>
> Do you mean, the listbox is not closed/hidden? If you set csdropdownlist
and the text in the entry is not in the list, it will not close/update the
combobox.
>

I mean, if I use MyCombo.DroppedDown:=True (internally, FDroppedDown:=True);
The listbox shows up, But if I click Outside of the Listbox, the listbox
disappers normally, its ok,  the problem is that internally FDroppedDown
doesn't get updated to False so if I test MyCombo.DroppedDown it returns
True, even when the listbox is hidden!.

> >While you are in this [ and if you have enought time ;)] could you
> >check if it is possible to trap all keyboard events before the
> >gtkwidget? It happen that TComboBox only have the keyboard control
> >when the itemindex=0 {VK_UP} or ItemIndex=Count-1 {VK_DOWN}.
>
> Please expound, I don't quite understand what you mean. Or better yet,
what do you want to do, maybe I can be of help.
>

A little example, suppose you have a ComboBox filled with 5 items, then
dropdown the listbox (using the arrow button for example) and select the
third item and press ENTER, the listbox disappear and now the combobox has
the focus. If you press the Down Key (VK_DOWN) the fourth item would be
selected but....

if you previously set up a KeyDown Event for this combobox, it wont get
called! some way the underlaying gtkwidget is handling this before the LCL
control, If it is possible, I would like to get this events first in order
to allow or deny the item selection.

There are two cases when this works normally: when the Itemindex:=0 And the
pressed key is [UP] and when Itemindex:=Items.Count-1 And the pressed key is
[DOWN], reading the gtk reference it appears that this is so by design as I
asked before: http://www.lazarus.freepascal.org/archives/msg02335.html


The goal I'm seeking here is to allow UP/DOWN keys ONLY IF the listbox is
poped up and let grid's selection move IF NOT.

What I want is to have Combobox editors in a grid  (mainly with option
goAlwaysShowEditor) in such way that moving between cells with ComboBox
Editors will not trap the keyboard focus (and doing unwished item
selections!) I want free key navigating instead.

> >In windows I was used to the ALT+DOWN hot key to dropdown the
> >listbox, in linux it seems it is not possible, which would be a
> >appropiated hotkey to this?.
>
> I think this is a GTK stuff, maybe we can simulate, but its going to be
ugly. But do note, that when you set csdropdownlist and maybe autodropdown
>  (though I am not sure what is the purpose of autodropdown, "Mattias can
you explain what is the purpose of autodropdown?") the listbox should
automatically
> show up when you press any key without the need to press ALT+DOWN .
>

As for the above explanation, I need a way to show the combobox listbox
using the keyboard, apart from F2 I was thinking on CTRL+DOWN?. I have not
checked other options apart from the default, I will check csDropDownList to
see if that fit the intended behaviour.

Perhaps what I want its easier to do in some other way, suggestions?

> >I dont know if I need to make some adjustment somewhere, It seems
> >that Undo functionality is missing in Gtk (for TEdit)?
> Maybe I can also check this at home.
>
> Regards,
>
> Yoyong

Thanks & Regards.

Jesus Reyes A.








More information about the Lazarus mailing list