Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ComboBox open and close programatically
#1
Hi All,
I need to move a dialog containing a combobox but it doesn't seem to move with the rest of the dialog.
See:

Function Dialog8
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str cb3
if(!ShowDialog("Dialog8" &Dialog8 &controls)) ret


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 ComboBox 0x54230243 0x0 34 24 96 213 ""
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "" "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Code:
Copy      Help
int w=win("Dialog" "#32770")
Acc a.Find(w "COMBOBOX" "" "class=ComboBox[]id=3" 0x1004)
a.Mouse(1)
mov xm+100 ym+100 w

If I could close the CB before the move that would be fine but I realize I don't know how to open or close a CB programatically.
It would also be nice to not have to close it i.e. for it to stay open through the move) but either solution will work.
Any ideas?
Thanks,
S
#2
CB_SHOWDROPDOWN
More info in MSDN.
#3
Ahhh. For some silly reason, I checked stack overflow but didn't go directly to MSDN. I am a big boy now and should be able to do some of these things myself!

https://msdn.microsoft.com/en-us/library...s.85).aspx

Here are a few CB extensions from just a few minutes of work on the MSDN site:


Function CB_ShowDropDown
Code:
Copy      Help
;/
function# hwnd [flags] ;;flags: 0 open dropdown (default), 1 close dropdown


;;Show or hide the list box of a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.


;hwnd - control handle.
if(flags&1)
,SendMessage(hwnd CB_SHOWDROPDOWN 0 0)
else
,SendMessage(hwnd CB_SHOWDROPDOWN 1 0)


Function CB_GetDroppedState
Code:
Copy      Help
;/
function# hwnd


,;Determines whether the list box of a combo box is dropped down.

;hwnd - control handle.
ret SendMessage(hwnd CB_GETDROPPEDSTATE 0 0)
,

Function CB_ToggleDroppedState
Code:
Copy      Help
;/
function# hwnd


,;Toggles dropped state of list box of a combo box

;hwnd - control handle.
;Return value = toggled state (1 open, 2 closed)

if(SendMessage(hwnd CB_GETDROPPEDSTATE 0 0))
,CB_ShowDropDown(hwnd 1)
,ret 0
else
,CB_ShowDropDown(hwnd)
,ret 1
,
,


Function CB_SetItemHeight
Code:
Copy      Help
;/
function# hwnd CbComponent height;; CbComponent: -1 set height of selection field, 0 height of list items, zero-based index of a specific list item (combo box must have CBS_OWNERDRAWVARIABLE style).

;Set height of list items or selection field in a combo box

;Returns 0 if successfully set, -1 if error
,
;hwnd - control handle.

ret SendMessage(hwnd CB_SETITEMHEIGHT CbComponent height)

,


I could do more when I have more time.
Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)