Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-06

Programmatically showing the listbox of combobox

20 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi all,

Have anyone tried to show the listbox of combobox programmatically? I managed to some point, but I need to manually select the combobox the first time inorder to set the dimensions of the listbox.

Yoyong

Reply by email

Jesus Reyes
to Unknown author

----- Original Message -----
From:
To:
Sent: Wednesday, June 04, 2003 5:39 PM
Subject: [lazarus] Programmatically showing the listbox of combobox

Hi all, Have anyone tried to show the listbox of combobox programmatically? I

managed to

some point, but I need to manually select the combobox the first time

inorder to

set the dimensions of the listbox.

I would like to know how to show the listbox, can you show me?.

Thanks

Jesus Reyes A.

Reply by email

Manuel Pérez López
to Unknown author: In gtkwinapi.inc function TgtkObject.ComboBoxDropDown(Handle: HWND; DropDown: boolean):…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is a new version at ftp of fpc 1.08 (with date 6/5/2003). Do anyone know if this is the stable 1.08 version?

- --

Saludos
Manuel P�rez L�pez

- -----------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+34nzYvl2oJ24QTwRAiGRAJ4wWnNy28qiAUxetluc6IHVHfyrzQCeIqPh 5ET8fF0Yz1esMlpLrifsL+M=
=3wH+
-----END PGP SIGNATURE-----

Reply by email

Unknown author

To Jesus,

In gtkwinapi.inc

function TgtkObject.ComboBoxDropDown(Handle: HWND; DropDown: boolean): boolean;
var
  ComboWidget: PGtkCombo;
begin
  Result:=false;
  if Handle=0 then exit;
  ComboWidget:=PGtkCombo(Handle);
  if DropDownGTK_WIDGET_VISIBLE(ComboWidget^.popwin) then begin
    if DropDown then begin
        writeln('TgtkObject.ComboBoxDropDown ToDo: Find the trick to popup the combobox');
     //code is here
     gtk_widget_show(ComboWidget^.popwin);
     //this will show the popwindow at the upper left side , a very small window
     //but if you first click the dropdown list and set to true ComboBoxDroppedDown of TCustomComboBox list box is okay
    end else
      gtk_widget_hide (ComboWidget^.popwin);
  end;
  Result:=true;
end;

I will send tomorrow my complete changes. As I have also changed some properties for the TCustomComboBox (My Lazarus machine is at home, I am still at my office)

Regards,

Yoyong

Internet Mail Message
Received from host:
svcr-216-37-230-2.dsl.svcr.epix.net
[216.37.230.2]

From: "Jesus Reyes" on 06/05/2003 05:43 AM GMT

"Jesus Reyes" To:
Cc: (bcc: Yoyong Hernan-ET/PGI)
Subject: RE: [lazarus] Programmatically
showing the listbox of combobox
06/05/2003 01:43 PM
Please respond to

Earlier message 26 lines
----- Original Message ----- From: To: Sent: Wednesday, June 04, 2003 5:39 PM Subject: [lazarus] Programmatically showing the listbox of combobox > Hi all, > > Have anyone tried to show the listbox of combobox programmatically? I managed to > some point, but I need to manually select the combobox the first time inorder to > set the dimensions of the listbox. > I would like to know how to show the listbox, can you show me?. Thanks Jesus Reyes A. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Unknown author

What is this patch for?

This patch will enable to programmatically show the list box of the combobox control.

How to use?

Set DroppedDown to true, e.g., combobox1.DroppedDown := True;
this cause the list box to show up.
Set DroppedDown to false to hide the list box, e.g, combobox1.DroppedDown := False;

changes to stdctrls.pp

213d212
< procedure CreateWnd; override;
260a259

property Style: TComboBoxStyle read FStyle write SetStyle;
281d279
<     property Style: TComboBoxStyle read FStyle write SetStyle;

changes to customcombobox.inc

77,81c77,79
< procedure TCustomComboBox.CreateWnd;
< begin
<   inherited CreateWnd;
<   CNSendMessage(LM_SETPROPERTIES, Self, nil);
< end;
---
{------------------------------------------------------------------------------ procedure TCustomComboBox.DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);

83,87d81
< {------------------------------------------------------------------------------ < procedure TCustomComboBox.DrawItem(Index: Integer; Rect: TRect; < State: TOwnerDrawState);
<
<
367,368c361
< if HandleAllocated then
< CNSendMessage(LM_SETPROPERTIES, Self, nil); ---

// ToDo

changes to gtkobject.inc

6030,6031c6030,6031
< csCombobox :
< with TCustomComboBox(Sender) do
---

csEdit : with TCustomEdit(Sender) do
6033,6045c6033,6040
<           case TCustomComboBox(Sender).Style of
<             csDropDownList :
<               begin
<                 gtk_combo_set_value_in_list(PgtkCombo(Handle),-1, 0);
<                 gtk_combo_set_use_arrows_always(PgtkCombo(Handle),-1);
<                 gtk_combo_set_case_sensitive(PGtkCombo(Handle),0);
<               end;
<             else
<               begin
<                 gtk_combo_set_value_in_list(PgtkCombo(Handle),0,0);
<                 gtk_combo_set_use_arrows_always(PgtkCombo(Handle),0);
<               end;
<           end;
---
Show quoted text 8 lines
// XXX TODO: GTK 1.x does not support EchoMode emNone. // This will have to be coded around, but not a priority gtk_entry_set_editable(PgtkEntry(Handle), not (TCustomEdit(Sender).ReadOnly)); gtk_entry_set_max_length(PgtkEntry(Handle), TCustomEdit(Sender).MaxLength); gtk_entry_set_visibility(PGtkEntry(Handle), (TCustomEdit(Sender).EchoMode = emNormal) and (TCustomEdit(Sender).PassWordChar=#0));

6047,6059d6042
< csEdit :
< with TCustomEdit(Sender) do
< begin
< // XXX TODO: GTK 1.x does not support EchoMode emNone. < // This will have to be coded around, but not a priority <
< gtk_entry_set_editable(PgtkEntry(Handle), not (TCustomEdit(Sender).ReadOnly)); < gtk_entry_set_max_length(PgtkEntry(Handle), TCustomEdit(Sender).MaxLength); < gtk_entry_set_visibility(PGtkEntry(Handle), < (TCustomEdit(Sender).EchoMode = emNormal) < and (TCustomEdit(Sender).PassWordChar=#0)); < end;
<

changes to gtkwinapi.inc

1941,1942c1941,1954
< procedure gtk_combo_get_pos(combo : PGtkCombo; var x : gint; var y : gint; var height : gint; var width : gint); < var
---

Show quoted text 14 lines
var ComboWidget: PGtkCombo; begin Result:=false; if Handle=0 then exit; ComboWidget:=PGtkCombo(Handle); if DropDownGTK_WIDGET_VISIBLE(ComboWidget^.popwin) then begin if DropDown then begin writeln('TgtkObject.ComboBoxDropDown ToDo: Find the trick to popup the combobox'); end else gtk_widget_hide (ComboWidget^.popwin); end; Result:=true; end;
1944,1962c1956,1959
<     popwin : PGtkbin;
<     widget : PGtkWidget;
<     popup : PGtkScrolledwindow;
<     real_height : gint;
<     list_requisition : PGtkRequisition;
<     show_hscroll : gboolean;
<     show_vscroll : gboolean;
<     avail_height : gint;
<     min_height : gint;
<     alloc_width : gint;
<     work_height : gint;
<     old_height : gint;
<     old_width : gint;
<     okay_to_exit : boolean;
<   const
<     EMPTY_LIST_HEIGHT = 15;
<   begin
<     show_hscroll := False;
<     show_vscroll := False;
---
{------------------------------------------------------------------------------ Function: ExtSelectClipRGN Params: dc, RGN, Mode Returns: integer
1964,1976c1961,1962
<     widget := GTK_WIDGET(combo);
<     popup  := GTK_SCROLLED_WINDOW (combo^.popup);
<     popwin := GTK_BIN (combo^.popwin);
<     gdk_window_get_origin (combo^.entry^.window, @x, @y);
<     real_height := MIN (combo^.entry^.requisition.height,
<              combo^.entry^.allocation.height);
<     y := y + real_height;
<     avail_height := gdk_screen_height () - y;
<     New(list_requisition);
<     gtk_widget_size_request (combo^.list, list_requisition);
<     min_height := list_requisition^.height;
< //    if min_height < popup^.vscrollbar^.requisition.height then
< //      min_height := popup^.vscrollbar^.requisition.height;
---
Combines the passed Region with the current clipping region in the device context (dc), using the specified mode.
1978,1980c1964,1965
<     min_height := MIN (list_requisition^.height,popup^.vscrollbar^.requisition.height);
<     if  GTK_LIST (combo^.list)^.children = nil then
<       list_requisition^.height := list_requisition^.height + EMPTY_LIST_HEIGHT;
---
The Combine Mode can be one of the following: RGN_AND : all points which are in both regions

1982,1987c1967
< alloc_width := (widget^.allocation.width -
< 2 * PGtkStyle(popwin^.child^.thestyle)^.klass^.xthickness - < 2 * border_width(GTK_CONTAINER (popwin^.child)^) - < 2 * border_width(GTK_CONTAINER (combo^.popup)^) - < 2 * border_width(GTK_CONTAINER (GTK_BIN (popup)^.child)^) - < 2 * PGtkStyle(GTK_BIN (popup)^.child^.thestyle)^.klass^.xthickness); ---

RGN_COPY : an exact copy of the source region, same as SelectClipRGN

1989,1993c1969,1970
< work_height := (2 * (PGtkStyle(popwin^.child^.thestyle)^.klass^.ythickness) + < 2 * border_width(GTK_CONTAINER (popwin^.child)^) + < 2 * border_width(GTK_CONTAINER (combo^.popup)^) + < 2 * border_width(GTK_CONTAINER (GTK_BIN (popup)^.child)^) + < 2 * PGtkStyle(GTK_BIN (popup)^.child^.thestyle)^.klass^.xthickness); ---

RGN_DIFF : all points which are in the Clipping Region but but not in the Source.(Clip - RGN)
1995,1998c1972,1973
<     repeat
<       okay_to_exit := True;
<       old_width := alloc_width;
<       old_height := work_height;
---
RGN_OR : all points which are in either the Clip Region or in the Source.(Clip + RGN)
2000,2020c1975,1976
<       if ((not show_hscroll) and (alloc_width < list_requisition^.width)) then
<       begin
<             work_height := work_height +  popup^.hscrollbar^.requisition.height +
<           GTK_SCROLLED_WINDOW_CLASS(GTK_OBJECT (combo^.popup)^.klass)^.scrollbar_spacing;
<         show_hscroll := TRUE;
<         okay_to_exit := False;
<       end;
<       if ((not show_vscroll) and (work

I have tried to use diff -ur --exclude=CVS /orig_lazarus/ /changed_laz/ | gzip > laz.diff.gz but I am generated a large file, maybe my working copy is quite old.
If it is better to send the generated file, please let me know.

Yoyong

Reply by email

Mattias Gaertner
to Unknown author: What is this patch for? This patch will enable to programmatically show the list box of…
Show quoted text 18 lines
What is this patch for? This patch will enable to programmatically show the list box of the combobox control. How to use? Set DroppedDown to true, e.g., combobox1.DroppedDown := True; this cause the list box to show up. Set DroppedDown to false to hide the list box, e.g, combobox1.DroppedDown := False;[...] I have tried to use diff -ur --exclude=CVS /orig_lazarus/ /changed_laz/ | gzip > laz.diff.gz but I am generated a large file, maybe my working copy is quite old. If it is better to send the generated file, please let me know.

Can you send a cvs -z3 diff -u | gzip > laz.diff.gz ?

Mattias

Reply by email

Jesus Reyes
to Unknown author: I have played around the combobox implementation and here is what I got. If you need to…

----- Original Message -----
From:
To:
Sent: Wednesday, June 11, 2003 5:51 PM
Subject: RE: [lazarus] Programmatically showing the listbox of combobox

Show quoted text 6 lines
Hi Jesus, I have played around the combobox implementation and here is what I got. If you need to trap arrow keys, we need the attached patch. And as for the FDroppedDown not updated, I am still working on it. If I may ask, why

would you

need to check the value of FDroppedDown.

I need the combobox to send the keyboard events to the parent grid in order to allow
normal grid navigation

I will be happy if I could get the following::

1. the combobox IS dropped down.

1.1. UP/DOWN key events => Item focus
1.2. LEFT/RIGHT key events => Item focus or Grid navigation ???
1.3. ENTER key event => Focused item is now the selected Item, hide listbox.
1.4. ESC key event => Selected item remains without changes, hide listbox
1.5. CTRL+DOWN => Same as ESC
1.6. Typing Text => Incremental search (item focusing)

2. the combobox IS NOT dropped down.

2.1. UP/DOWN key events => Grid navigation 2.2. LEFT/RIGHT key events => Grid navigation 2.3. ENTER key event => unhandled or same as 2.5 ??? 2.4. ESC key event => unhandled
2.5. CTRL+DOWN => drop down the listbox to allow 1.1,1.2 or 1.6
2.6. Typing Text =>{Dropdown the listbox ???,}Inc. search (item selection)

The way is now, it sometimes does Item selection and sometimes Grid navigation, depending on the current item selection! (2.1).

If the lcl combobox will get all key events (being the listbox droppedown or not), I need a way to know when to do Item Selection or grid navigation and this depends on DroppedDown Property, at least in the way I planned.

In my program, when I set Style to csDroppedDown, AutoDropDown = True, and I type something on the entry box

I

cannot get out of the listbox not unless I select an item from the list. Also, if you need to trap VK_UP or VK_DOWN, the attached file adds another

property

for the combo box name ArrowKeysTraverseList with a default value of

True. This

is the defualt behaviour of the combo box(gtk widget default behaviour), especially if you set style to csdropdownlist. Now if you set ArrowKeysTraverseList to False and AutoDroppedDown to false and I am not

sure

style to csdroppedownlist you should be able to trap VK_UP or VK_DOWN. And

also

Show quoted text 6 lines
the patch implemented the key sequence Ctrl+Down to show the popup. Regards Yoyong

Thank you, It sounds nice I will update as soon the patches are in cvs ;)

What do you think, are we asking to much to gtk?. I'm asking this because for example, if I need a multicolumn listbox, with headers, footers and other goodies, does the underlaying gtkwidget provide such functionality or we need to wrap another one. if this is the case, aren't we being too gtk dependant? I mean what if others interfaces doesn't have a so-similar widget?.

Thanks.

Jesus Reyes A.

Reply by email

Unknown author

Hi Jesus,

I have played around the combobox implementation and here is what I got.

If you need to trap arrow keys, we need the attached patch. And as for the FDroppedDown not updated, I am still working on it. If I may ask, why would you need to check the value of FDroppedDown. In my program, when I set Style to csDroppedDown, AutoDropDown = True, and I type something on the entry box I cannot get out of the listbox not unless I select an item from the list. Also, if you need to trap VK_UP or VK_DOWN, the attached file adds another property for the combo box name ArrowKeysTraverseList with a default value of True. This is the defualt behaviour of the combo box(gtk widget default behaviour), especially if you set style to csdropdownlist. Now if you set ArrowKeysTraverseList to False and AutoDroppedDown to false and I am not sure style to csdroppedownlist you should be able to trap VK_UP or VK_DOWN. And also the patch implemented the key sequence Ctrl+Down to show the popup.

Regards

Yoyong

Internet Mail Message
Received from host:
svcr-216-37-230-2.dsl.svcr.epix.net
[216.37.230.2]

From: "Jesus Reyes" on 06/11/2003 05:14 AM GMT

"Jesus Reyes" To:
Cc: (bcc: Yoyong Hernan-ET/PGI)
Subject: RE: [lazarus] Programmatically
showing the listbox of combobox
06/11/2003 01:14 PM
Please respond to

Earlier message 95 lines
----- Original Message ----- From: To: 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. _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Jesus Reyes
to Unknown author: If I understand it right, I have to set csdropdownlist and autodropdown property to drop…

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.

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}.

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 dont know if I need to make some adjustment somewhere, It seems that Undo functionality is missing in Gtk (for TEdit)?

Thanks.

--- escribi�: > Hi Mattias,

Show quoted text 56 lines
If I understand it right, I have to set csdropdownlist and autodropdown property to drop the listbox automatically? Regards, Yoyong On Tue, 10 Jun 2003 07:43:27 +0800 wrote: > Hi Mattias, > > This one is not included in cvs. > > under protected section of TCustomComboBox > > procedure WMChar(var Message: TLMChar); message LM_CHAR; > > its implementation is > > Why need this one? Well, if csdropdonwlist is selected in the object > inspector, the listbox must dropdown if the user type some character in > the textbox entry. In Delphi the csdropdonwlist style is defined as a combobox with readonly text field. Do you mean the AutoDropDown property? > procedure TCustomComboBox.WMChar(var Message: TLMChar); The LCL tries to use methods instead of messages. I overrode the KeyDown method. Maybe you can have a look. > Please forgive me again this time for not sending a patch file. I forgive. ;) Any help is welcome. Mattias _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________ Do You Yahoo!?
La mejor conexi�n a internet y 25MB extra a tu correo por $100 al mes. http://net.yahoo.com.mx

Reply by email

Unknown author

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.

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.

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 .

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 ,

Yoyong

Show quoted text 54 lines
Thanks. --- escribi�: > Hi Mattias, > > If I understand it right, I have to set csdropdownlist and > autodropdown property > to drop the listbox automatically? > > Regards, > > Yoyong > > > > > On Tue, 10 Jun 2003 07:43:27 +0800 > wrote: > > > Hi Mattias, > > > > This one is not included in cvs. > > > > under protected section of TCustomComboBox > > > > procedure WMChar(var Message: TLMChar); message LM_CHAR; > > > > its implementation is > > > > Why need this one? Well, if csdropdonwlist is selected in the > object > > inspector, the listbox must dropdown if the user type some > character in > > the textbox entry. > > In Delphi the csdropdonwlist style is defined as a combobox with > readonly > text field. > Do you mean the AutoDropDown property? > > > > procedure TCustomComboBox.WMChar(var Message: TLMChar); > > The LCL tries to use methods instead of messages. I overrode the > KeyDown > method. Maybe you can have a look. > > > > Please forgive me again this time for not sending a patch file. > > I forgive. ;) > Any help is welcome. > > > Mattias

Reply by email

Unknown author

Hi Mattias,

If I understand it right, I have to set csdropdownlist and autodropdown property to drop the listbox automatically?

Regards,

Yoyong

Show quoted text 13 lines
Hi Mattias, This one is not included in cvs. under protected section of TCustomComboBox procedure WMChar(var Message: TLMChar); message LM_CHAR; its implementation is Why need this one? Well, if csdropdonwlist is selected in the object inspector, the listbox must dropdown if the user type some character in the textbox entry.

In Delphi the csdropdonwlist style is defined as a combobox with readonly text field.
Do you mean the AutoDropDown property?

procedure TCustomComboBox.WMChar(var Message: TLMChar);

The LCL tries to use methods instead of messages. I overrode the KeyDown method. Maybe you can have a look.

Please forgive me again this time for not sending a patch file.

I forgive. ;)
Any help is welcome.

Mattias

Reply by email

Unknown author
Show quoted text 12 lines
> Hi Jesus, > > 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!.

This is indeed a problem, I will try to check this at home.

Show quoted text 15 lines
> > 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.

I will also try to experiment , I am using Windows while a work.

Show quoted text 13 lines
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.

Regards,

Yoyong

Reply by email

Jesus Reyes
to Unknown author: Do you mean, the listbox is not closed/hidden? If you set csdropdownlist and the text in…

----- Original Message -----
From:
To:
Sent: Tuesday, June 10, 2003 7:24 PM
Subject: Re: [lazarus] Programmatically showing the listbox of combobox

Show quoted text 7 lines
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!.

Show quoted text 6 lines
>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.

Show quoted text 5 lines
>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?

Show quoted text 7 lines
>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.

Reply by email

Unknown author

Hi Jesus,

Regarding your question whether it is possible to have a milti-column listbox, well it is possible. If you have time reading the gtk reference, you will find that the list of items that can be displayed by the GtkCombo can be any item that is PGtkItem, or was it PgtkWidget???? So basically, you can pack any controls you want into the list for GtkCombo? But I am not sure if we can put some headers and footers. Maybe it is better to implement it ourselves not relying onto GtkCombo list property.

BTW, any updates on your TDBGrid unit. It seems to have a problem with current version of lazarus. I have tried it at home, it gives some AV on DC brushes or something like that.

Regards,

Yoyong

Show quoted text 79 lines
> Hi Jesus, > > I have played around the combobox implementation and here is what I got. > > If you need to trap arrow keys, we need the attached patch. And as for the > FDroppedDown not updated, I am still working on it. If I may ask, why would you > need to check the value of FDroppedDown. I need the combobox to send the keyboard events to the parent grid in order to allow normal grid navigation I will be happy if I could get the following:: 1. the combobox IS dropped down. 1.1. UP/DOWN key events => Item focus 1.2. LEFT/RIGHT key events => Item focus or Grid navigation ??? 1.3. ENTER key event => Focused item is now the selected Item, hide listbox. 1.4. ESC key event => Selected item remains without changes, hide listbox 1.5. CTRL+DOWN => Same as ESC 1.6. Typing Text => Incremental search (item focusing) 2. the combobox IS NOT dropped down. 2.1. UP/DOWN key events => Grid navigation 2.2. LEFT/RIGHT key events => Grid navigation 2.3. ENTER key event => unhandled or same as 2.5 ??? 2.4. ESC key event => unhandled 2.5. CTRL+DOWN => drop down the listbox to allow 1.1,1.2 or 1.6 2.6. Typing Text =>{Dropdown the listbox ???,}Inc. search (item selection) The way is now, it sometimes does Item selection and sometimes Grid navigation, depending on the current item selection! (2.1). If the lcl combobox will get all key events (being the listbox droppedown or not), I need a way to know when to do Item Selection or grid navigation and this depends on DroppedDown Property, at least in the way I planned. > In my program, when I set Style to > csDroppedDown, AutoDropDown = True, and I type something on the entry box I > cannot get out of the listbox not unless I select an item from the list. > Also, > if you need to trap VK_UP or VK_DOWN, the attached file adds another property > for the combo box name ArrowKeysTraverseList with a default value of True. This > is the defualt behaviour of the combo box(gtk widget default behaviour), > especially if you set style to csdropdownlist. Now if you set > ArrowKeysTraverseList to False and AutoDroppedDown to false and I am not sure > style to csdroppedownlist you should be able to trap VK_UP or VK_DOWN. And also > the patch implemented the key sequence Ctrl+Down to show the popup. > > Regards > > Yoyong > Thank you, It sounds nice I will update as soon the patches are in cvs ;) What do you think, are we asking to much to gtk?. I'm asking this because for example, if I need a multicolumn listbox, with headers, footers and other goodies, does the underlaying gtkwidget provide such functionality or we need to wrap another one. if this is the case, aren't we being too gtk dependant? I mean what if others interfaces doesn't have a so-similar widget?. Thanks. Jesus Reyes A.

Reply by email