Newbie have COMBOBOX Question

Post Reply
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Newbie have COMBOBOX Question

Post 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 ... :shock:

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

Re: Newbie have COMBOBOX Question

Post 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 :D
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8761
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: Newbie have COMBOBOX Question

Post 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.
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Newbie have COMBOBOX Question

Post 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.
Image
greeting,
Jimmy
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Newbie have COMBOBOX Question

Post 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
greeting,
Jimmy
User avatar
Otto
Posts: 6412
Joined: Fri Oct 07, 2005 7:07 pm
Has thanked: 27 times
Been thanked: 2 times
Contact:

Re: Newbie have COMBOBOX Question

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Post Reply