Just in case this blew by everyone because of a lack of explanation.

What Larry was asking about the CB_SETDROPPEDWIDTH constant with respect to a ComboBox is when you have a ComboBox Item that is say 60 or so characters in width and the RealEstate you want to dedicate to the ComboBox on your form is maybe 120 px or so, then the dropdown portion has to be scrolled or you can't see your 60 char item.

By executing the code in the example and setting the DROPWIDTH variable to the pixel value you want for the width of the dropdown, you can set it to the width you want. If the DLCall is successful, the value of the vRet variable will be the new width setting of the DropDown.

<snip>
Here ya go!   The Width of the dropdown can't be LESS than the width of the
Combobox and the combobox STYLE must either be csDROPDOWN or csDROPDOWNLIST
(use EE Object inspector)

{begin code in onAfterStart eep}
DEBUG TRACE
SET VAR CB_SETDROPWIDTH INTEGER = 352
SET VAR CB_ERR INTEGER = -1
SET VAR DROPWIDTH INTEGER = 200
SET VAR hCbo INTEGER = 0
SET VAR hCbotx TEXT = NULL

GETPROPERTY CboOne HANDLE 'hcbotx'

SET VAR hCbo INTEGER = (INT(.hCbotx))
{
Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer,
ByVal lParam As Any) As Long
}
IF (chkfunc('SendMessage')) = 0 THEN
 STDCALL function 'SendMessageA' alias 'SendMessage'  +
 (integer, integer, integer, integer) : integer

ENDIF
-- remember the order of args  is reversed from the API declaration
SET VAR vret INTEGER = +
(dlcall('User32', 'SendMessageA', 0 , DROPWIDTH, CB_SETDROPWIDTH, hCbo))

IF vret = .CB_ERR THEN
 PAUSE 2 USING 'SendMessage to ComboBox didn''t work'
ELSE
 SET VAR vmsg = ('Width of ComboBox set to ' + (CTXT(.vret)))
 PAUSE 2 USING .vmsg
ENDIF

RETURN
{end code in onAfterStart eep}


Reply via email to