Newbie have COMBOBOX Question

Newbie have COMBOBOX Question

Postby Jimmy » Sun Oct 30, 2022 5:21 am

hi,

i have
Code: Select all  Expand view  RUN
  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 ... :shock:

what i´m doing wrong :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Newbie have COMBOBOX Question

Postby Jimmy » Sun Oct 30, 2022 6:19 am

Ok, i have change to OOP Style instead of #xcommand
Code: Select all  Expand view  RUN
  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 view  RUN
STATIC PROCEDURE DoResize( oMain )
   oCombo_Left:SetPos( 0,0)
   oCombo_Right:SetPos( 0, nWidth/2 )

this work without Problem :D
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Newbie have COMBOBOX Question

Postby Enrico Maria Giordano » Sun Oct 30, 2022 8:01 am

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.
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Newbie have COMBOBOX Question

Postby Jimmy » Sun Oct 30, 2022 10:08 am

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 view  RUN
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 view  RUN
  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.
Image
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Newbie have COMBOBOX Question

Postby Jimmy » Sun Oct 30, 2022 1:09 pm

hi,

found a Solution
Code: Select all  Expand view  RUN
oCombo_Right:bKeyDown := { |nKey| IF(nKey=13,MsgInfo(oCombo_Right:GetSelText()),nil )}

not sure if it is right Way ... but i got right Result
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Re: Newbie have COMBOBOX Question

Postby Otto » Sun Oct 30, 2022 3:13 pm

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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6340
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests