Page 1 of 1
Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 5:21 am
by Jimmy
hi,
i have
Code: Select all | Expand
LOCAL aDrives := aDrives()
@ 0,0 COMBOBOX oCombo_left ITEMS aDrives SIZE 100,300 PIXEL
// while Combobox does not show 1st Drive
oCombo_left:Select(1)
// need later when resize
oCombo_Left:SetPos( 30,0)
but both Method give Error ...
what i´m doing wrong

Re: Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 6:19 am
by Jimmy
Ok, i have change to OOP Style instead of #xcommand
Code: Select all | Expand
oCombo_left := TComboBox():new(0,0 , , aDrives, 100, 300,oMain)
oCombo_left:Select(1)
Combo_Right := TComboBox():new(0, nWidth/2, , aDrives, 100, 300, oMain)
Combo_Right:Select(1)
Code: Select all | Expand
STATIC PROCEDURE DoResize( oMain )
oCombo_Left:SetPos( 0,0)
oCombo_Right:SetPos( 0, nWidth/2 )
this work without Problem

Re: Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 8:01 am
by Enrico Maria Giordano
Please, always post a complete sample of the problem. You don't need to use Select() nor SetPos() with Comboboxes. And commands are the best option in 99% of code. Commands are far more readable and maintainable than functions.
Re: Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 10:08 am
by Jimmy
hi Enrico,
Enrico Maria Giordano wrote:Please, always post a complete sample of the problem.
i understand that a Sample is need to reproduce Problem, but as Newbie i "ask" for a (simple) Sample
---
i found out that 3rd Parameter bSetGet is used when "on change" Event is fired
Sample i saw look like this
Code: Select all | Expand
local cItem
o:bSetGet := {|u| If( PCount()==0, citem , citem := u ) }
now i have "Value" in cItem but what about ENTER (or Dblclick)
which Codeblock ( from which Super CLASS ) have to be use
---
for RbDown i found this
Code: Select all | Expand
oCbx:bRClicked = { | nRow, nCol | EditControl( nRow, nCol, oCbx ) }
Enrico Maria Giordano wrote:You don't need to use Select() nor SetPos() with Comboboxes. And commands are the best option in 99% of code. Commands are far more readable and maintainable than functions.
this is while i put 2 x "Explorer" into Window and each "Side" have a own Combobox
when "resize" e.g. "maximize" i need to calculate new Position of Control.

Re: Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 1:09 pm
by Jimmy
hi,
found a Solution
Code: Select all | Expand
oCombo_Right:bKeyDown := { |nKey| IF(nKey=13,MsgInfo(oCombo_Right:GetSelText()),nil )}
not sure if it is right Way ... but i got right Result
Re: Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 1:24 pm
by Enrico Maria Giordano
It looks right to me.
Re: Newbie have COMBOBOX Question
Posted: Sun Oct 30, 2022 3:13 pm
by Otto
Hi Jimmy,
with Fivewin you have all the source code of the classes:
c:\fwh\source\classes\combobox.prg
You can link in the class and insert msginfo() to see where you are.
I always use: msginfo( procname() + " " + str(procline()) )
Thank you for your hard work. I am glad you joined our group.
Best regards,
Otto