Hello Otto,
Do we need a changed tComboBox?
Not. Only include this stretch in his file .PRG main:
extend class TCombobox with message getItemheight( nItem ) inline ::SendMsg( CB_GETITEMHEIGTH, nItem, 0 )
extend class TCombobox with message setItemheight( nHeight ) inline ::SendMsg( CB_SETITEMHEIGTH, , nHeight )
extend class TCombobox with message GETDROPPEDWIDTH() inline ::SendMsg( CB_GETDROPPEDWIDTH, 0, 0 )
extend class TCombobox with message SETDROPPEDWIDTH( nWidth ) inline ::SendMsg( CB_SETDROPPEDWIDTH, nWidth, 0 )
Here the example translated into the English:
#include "FiveWin.ch"
#define COMBO_BASE 320
#define CB_SETITEMHEIGTH ( COMBO_BASE + 19 )
#define CB_GETITEMHEIGTH ( COMBO_BASE + 20 )
#define CB_SETDROPPEDWIDTH 0x0160
#define CB_GETDROPPEDWIDTH ( COMBO_BASE + 25 )
function Main()
local oDlg, oCbx
local aEstados := { "AC Acre", "AL Alagoas", "AM AmazĂ´nia", "AP Amapá", "BA Bahia", "CE Ceará", "DF Distrito Federal", "ES Espirito Santo", "EX Exterior", "GO Goias", "MA MaranhĂŁo", "MG Minas Gerais", "MS Mato Grosso Sul", "MT Mato Grosso", "PA Pará", "PB Paraiba", "PE Pernambuco", "PI PiauĂ", "PR Paraná", "RJ Rio de Janeiro", "RN Rio Grande Norte", "RO RondĂ´nia", "RR Roraima", "RS Rio Grande Sul", "SC Santa Catarina", "SE Sergipe", "SP SĂŁo Paulo", "TO Tocantins" }
local cText := aEstados[1]
* Here you return the height of the line of the combobox, when he is open
extend class TCombobox with message getItemheight( nItem ) inline ::SendMsg( CB_GETITEMHEIGTH, nItem, 0 )
* Here you defined the height of the line of the combobox, when he is open
extend class TCombobox with message setItemheight( nHeight ) inline ::SendMsg( CB_SETITEMHEIGTH, , nHeight )
* Here you return the width of the line of the combobox, when he is open
extend class TCombobox with message GETDROPPEDWIDTH() inline ::SendMsg( CB_GETDROPPEDWIDTH, 0, 0 )
* Here you defined the width of the line of the combobox, when he is open
extend class TCombobox with message SETDROPPEDWIDTH( nWidth ) inline ::SendMsg( CB_SETDROPPEDWIDTH, nWidth, 0 )
DEFINE DIALOG oDlg FROM 0, 0 TO 200, 200 ;
TITLE "DropDown ComboBox Test" pixel
@ 10, 10 COMBOBOX oCbx VAR cText STYLE CBS_DROPDOWNLIST ; && CBS_DROPDOWN ;
ITEMS aEstados size 20, 100 ;
ON CHANGE oDlg:SetText( cText ) pixel
oCbx:bgotfocus := { |oObj| ( oObj:setItemheight( 20 ), oObj:setdroppedwidth( 200 ), oObj:refresh() ) }
ACTIVATE DIALOG oDlg CENTERED
return nil