Programmatically expand COMBO to show drop down list?

Hi,
How programmatically expand COMBO?

POST(EVENT: what???, ?COMBO1)

SELECT (?COMBO1); PRESS (CtrlDown) ! Not work :frowning:

Michael

   MODULE('')
     PostMessage(UNSIGNED hWnd,UNSIGNED wMsg,UNSIGNED wParam,|
        LONG lParam),BOOL,PASCAL,NAME('PostMessageA'),PROC
   END

ShowDropDown PROCEDURE(LONG pFEQ) 
fCB LONG
hCB LONG
CB_SHOWDROPDOWN EQUATE(014Fh)

   CODE

    fCB = pFEQ{PROP:ButtonFeq}
    hCB = fCB{PROP:Handle}
    PostMessage(hcb,CB_SHOWDROPDOWN,1,0)
2 Likes

This API call does it for me:

See Post #11 for revised  
CODE
1 Like

Thanks, it works! :slight_smile:
I combined both tips into something like this (and MAP PostMessage)

ShowDropDown PROCEDURE (LONG pFEQ, BYTE RollUp = 0)
fCB LONG
CB_SHOWDROPDOWN EQUATE (014Fh)
CODE
fCB = pFEQ {PROP: ButtonFeq}
PostMessage (fCB {PROP: Handle}, CB_SHOWDROPDOWN, 1-RollUp, 0)

Michael,
I am curious as to when/what user input within a procedure prompts the need to drop down a combo?
Douglas

@totalhip,
Filter button also serves (next click) as a quick view / change of the current filtering - at the same time there will be no reports that filtering is not working - 2 in 1 :wink:
Michael

If I understand correctly - a click of the filter button resets the view AND drops the combo?

@totalhip
This button starts filtering, but another press without changing the conditions doesn’t change the view, so now it shows the list of combinations right away - to show what you can switch to (combo not the only filter, there are other filters checkbox).
And another button clears the filters.

Generally, I wanted to know a combo control solution to maybe improve something.

Just looking for ideas as to when forcing a combo drop might be useful. In my derived combo class, queue loading does not occur until x# of keys have been entered. There is also an option to do a LIKE sql select instead of an alpha select. Forcing a drop for LIKE might be very useful.

Just tested and definitely not recommended for use with AnyScreen.

My code from post #3 was missing COMBO support, your code does not handle LIST. Below code handles both Drop LIST and Drop COMBO:

  MAP   
ListDropDown PROCEDURE(LONG FeqList, BOOL RollUp=0)  !0=Down 1=Up  
   MODULE('Win32')
     PostMessage(LONG hWnd,LONG wMsg,LONG wParam,LONG lParam),BOOL,PROC,PASCAL,DLL(1),NAME('PostMessageA')
   END                                                                        !^^^^^^
  END
ListDropDown PROCEDURE(LONG FeqList, BOOL RollUp=0)  !0=Down 1=Up
  CODE  !CB_SHOWDROPDOWN = &H14F
  IF FeqList{PROP:Type}=CREATE:Combo THEN 
     FeqList=FeqList{PROP:ButtonFeq}      !COMBO must Post to Drop Button FEQ
  END                                     !LIST  just post to List FEQ
  PostMessage(FeqList{PROP:Handle},14Fh,1-RollUp,0)  !wParam 1=Show Drop, 0=Hide Drop
  RETURN 

Tip: Note the DLL(1) on the PostMessage declaration… That tells the Compiler its External so it writes better code for the Linker. Without DLL(1) the Linker has to add a indirection thunk so calls are a tiny bit slower as it it calls the stub which trampolines to the real function entry point in the destination DLL…

The Clarion DLL() attribute is the same as Microsoft __declspec(dllimport). Ray Chen has a series on DLL imports and exports. In short you can get away with DLL() wrong on a Procedure but it costs you a tiny penalty. On Data or a Class a wrong DLL() will fail build or GPF.