Page 1 of 1

Question about ComboBox

PostPosted: Thu Aug 03, 2017 8:40 pm
by vilian
Hi Guys,

Do you know if is possible to do a combobox with the lenght of area (2)(see image) bigger than area (1) ?

Image

Re: Question about ComboBox

PostPosted: Thu Aug 03, 2017 8:45 pm
by cnavarro
Wider?

Re: Question about ComboBox

PostPosted: Thu Aug 03, 2017 8:49 pm
by vilian
Yes !

Re: Question about ComboBox

PostPosted: Thu Aug 03, 2017 10:13 pm
by nageswaragunupudi
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oWnd, oCbx
   local aItems   := { "One", "Two", "Three" }
   local nItem    := 1

   DEFINE WINDOW oWnd

   @ 60, 20 COMBOBOX oCbx VAR nItem ITEMS aItems SIZE 100,400 PIXEL OF oWnd
   oCbx:SendMsg( 0x160, 250, 0 )
   @ 60,300 BUTTON "OK" SIZE 60,30 PIXEL OF oWnd

   ACTIVATE WINDOW oWnd CENTERED

return nil
 


Image

Re: Question about ComboBox

PostPosted: Thu Aug 03, 2017 10:33 pm
by vilian
Mr Rao,

Thank you :)

Re: Question about ComboBox

PostPosted: Sat Aug 05, 2017 1:53 am
by ShumingWang
Mr Rao
How to change combobox top area size at runtime ?
Image
TKS!
Shuming Wang

Re: Question about ComboBox

PostPosted: Sat Aug 05, 2017 3:41 pm
by nageswaragunupudi
Do you mean height?
While creating, you can use clause HEIGHTGET nHeight.
Do you want to change at runtime? May I know why?

Re: Question about ComboBox

PostPosted: Mon Aug 07, 2017 2:36 am
by ShumingWang
...
activate dialog odlg on init resize(odlg)

function resize(odlg,res)
rsl0:=getsysmetrics(0)/res //width,col

if rsl0<>1;

//<=800*600, not needed

rsl1:=getsysmetrics(1)/if(res==800,600,768) //base height ,nrow
for i:=1 TO LEN(::acontrols)
oCtrol = odlg:aControls[i] // top:nrow, left:ncol,bottom: nrow, right:ncol
aRect = GetCoors( oCtrol:hWnd )
do case
case oCtrol:classname()=="TCOMBOBOX"
oCtrol:Move( aRect[1]*rsl1, aRect[2]*rsl0 )
// cant not set height of combobox : oget height,listbox height
otherwise
oCtrol:Move( aRect[1]*rsl1, aRect[2]*rsl0,(aRect[4] - aRect[2])*rsl0, (aRect[3] - aRect[1])*rsl1, .t. )
// ntop,nleft,nbottom,nright
end case
next
endif

return

Re: Question about ComboBox

PostPosted: Mon Aug 07, 2017 8:48 am
by nageswaragunupudi
Code: Select all  Expand view
SendMessage( oCbx:hWnd, 0x0153, -1, nNewHeight )

Re: Question about ComboBox

PostPosted: Mon Aug 07, 2017 10:21 am
by byte-one
I found, sendmessage(..) must be on the ON INIT clausula from the dialog.

Re: Question about ComboBox

PostPosted: Tue Aug 08, 2017 12:21 am
by nageswaragunupudi
byte-one wrote:I found, sendmessage(..) must be on the ON INIT clausula from the dialog.

Yes, ofcourse.
In case of dialog hWnd gets a value only ON INIT.

Re: Question about ComboBox

PostPosted: Thu Aug 10, 2017 4:20 am
by ShumingWang
Works fine!
Thank you MR Rao!
Shuming Wang

Re: Question about ComboBox

PostPosted: Thu Aug 17, 2017 7:15 am
by ShumingWang
Mr Rao,
A small problem with SendMessage( oCbx:hWnd, 0x0153, -1, nNewHeight ),combobox be blue colored background on init .
Image
Regards!
Shuming Wang