From: Lothar Ochmann on
How can I set the focus to the Editcontrol of a combobox? Calling the method
ComboBox:setfocus() doesn't work.

THX in advance and a happy, successful New Year
Lothar


From: Michael Rubinstein on
Lothar, SetFocus() will not work on a Combo Box because it is a
composite control, but you can set focus to the edit part of the Combo Box
control. Something like this:

METHOD ForceComboEditFocus(oMyComboBox) CLASS MyWindow
LOCAL strComboBoxInfo IS _winComboBoxInfo

strComboBoxInfo.cbSize := _sizeof(_winComboBoxInfo)
IF GetComboBoxInfo(oMyComboBox:Handle(),@strComboBoxInfo)
SetFocus(strComboBoxInfo.hWndItem)
ENDIF
ENDIF

RETURN NIL

HTH, Michael

"Lothar Ochmann" <lothar(a)ochmann.net> wrote in message
news:dp65s4$e4i$01$1(a)news.t-online.com...
> How can I set the focus to the Editcontrol of a combobox? Calling the
> method
> ComboBox:setfocus() doesn't work.
>
> THX in advance and a happy, successful New Year
> Lothar
>


From: GSchaller on
Michael,

> Lothar, SetFocus() will not work on a Combo Box because it is a
> composite control, but you can set focus to the edit part of the Combo Box
> control. Something like this:

I'm a bit confused with this. We routinely set focus to the combo box or
do you mean something else?

Geoff


From: Michael Rubinstein on
Geoff, you are right, ComboBox:SetFocus() should work just fine. I used
an existing application with a dialog on a tab page for a quick test and
called SetFocus when a different tab was shown. Focus shifted to the first
control in control the control once the tab with the combo box was selected,
creating an illusion of the method not producing the expected result. No
workaround required, whatever problem Lothar encountered must be caused by
another method called after ComboBox:SetFocus().

Michael

"GSchaller" <geoff(a)softxxwareobjectives.com.au> wrote in message
news:43b880ab$1(a)dnews.tpgi.com.au...
> Michael,
>
>> Lothar, SetFocus() will not work on a Combo Box because it is a
>> composite control, but you can set focus to the edit part of the Combo
>> Box
>> control. Something like this:
>
> I'm a bit confused with this. We routinely set focus to the combo box or
> do you mean something else?
>
> Geoff
>
>


From: Lothar Ochmann on
Michael & Geoff,
thanks to you! I have tested also with a new dialog & tabwin, the focus was
set automaticly and remained after switching between tabs.

I dont'n know, why my dialog showed an other behaviour ( I tried to set the
focus manually because there was no automatic focus ) but I found a
solution:
After calling the setfocus() from the parentwindow it works properly.

But I have a further problem with setfocus(), now is it
SinglelineEdit:setfocus(). My Browserwindows have a Toolbar for seeking.
Inside this tb there is a sle, which takes the keywords. This sle should
have the focus, when I open the Browserwindow.
Some code:

// sleSuch anzeigen
_oDCSleSuche:= SingleLineEdit{SELF:Toolbar,0,Point{0,0},Dimension{10,40} }
_oDCSleSuche:hyperlabel:= HyperLabel{ #sleSuche, "sleSuche" }
_oDCSleSuche:setstyle (WS_Tabstop+ES_AutoHScroll+WS_Child,TRUE)
SELF:Toolbar:AddBand(#suche, _oDCsleSuche, , 100 , 25 ,"Suche:")

_oDCSleSuche is an export instance and holds the control. I tried to call
_oDCSleSuche:setfocus() in the postinit of the window or directly before
oWin:show(), both without success.

THX and regards
Lothar

-----Urspr?ngliche Nachricht-----
Von: "Lothar Ochmann" <lothar(a)ochmann.net>
Newsgroups: comp.lang.clipper.visual-objects
Gesendet: Samstag, 31. Dezember 2005 15:50
Betreff: ComboBox:setfocus()


> How can I set the focus to the Editcontrol of a combobox? Calling the
> method
> ComboBox:setfocus() doesn't work.
>
> THX in advance and a happy, successful New Year
> Lothar
>