How to use the Edit Box in a ComboBox

Started by gian young, May 29, 2005, 10:22:02 PM

Previous topic - Next topic

gian young

Hi,

I am using a Combobox Control in FireFly with the CBS_DROPDOWN Style, this style allows me to Edit/Change the content of the Edit Box from the keyboard.

Can anyone tell me how I can programmatically read the changed text content of the Combobox Edit box.

The FireFly FF_ComboBox_GetText command only reads the content of the Combobox's selected index.?? not the text in the Edit Box.

Any assistance appreciated.    8)

Regards Gian

Gian Young Australia

TechSupport

Hi Gian,

I am pretty sure that a simple FF_Control_GetText will retrieve the text from the edit box:

FF_Control_GetText(HWND_FORM1_COMBO1)

gian young

Thank you for your reply Paul.

You are quite correct, FF_Control_GetText (HWND_FORM1_COMBO1)
works as needed.

I now feel a jerk because I swear I tried this unsuccessfully before posting the question.   :oops:  

Anyway it's welcome to know that help is at hand when required.  :)

Best Regards

Gian

Roger Garstang

The Edit Portion is also a child of the Combo, so you could get even more creative and set it up and send messages to it like an Edit control.  I can't recall the ID offhand, but I gave it to Paul sometime back, and I think it may still be used in generated code...plus WinSpy can give it to you.  It is something simple like 101 or something.

Jean-Pierre LEROY

Hi,

I'm also using a ComboBox control in FireFly with the CBS_DROPDOWN style (Editable ComboBox like a TextBox) for the first time.

It seems we can use both FF_Control_GetText or FF_Textbox_GetText to retrieve the text from the ComboBox in this case.

Paul is there any difference between these two functions ?

Thank you
Jean-Pierre.

TechSupport

If you look at the generated code for those functions you will notice that the ff_control_gettext uses:

        GetWindowText hWndControl, ByVal StrPtr(nBuffer), nBufferSize


The ff_combobox_gettext uses:

        If SendMessage( hWndControl, %CB_GETLBTEXT, nIndex, ByVal StrPtr(nBuffer)) = %CB_ERR Then


Personally, if there is a more specific message for a control then I would use that (i.e. ff_combobox_gettext).

Jean-Pierre LEROY

Hi Paul,

Thank you you for your reply but my question was between FF_Control_GetText and FF_Textbox_GetText; in this cas the generated code seems to be the same.

Jean-Pierre