Page 1 of 1
How can I expand ComboBox via application
Posted: Thu Oct 18, 2018 7:39 pm
by mol
Do anybody know the way to expand ComboBox?
I need to set focus and expand this control automatically...
Re: How can I expand ComboBox via application
Posted: Thu Oct 18, 2018 8:21 pm
by serge_girard
Hi Marek,
What do you mean with expand? Add Items or enlarge combobox?
Serge
Re: How can I expand ComboBox via application
Posted: Fri Oct 19, 2018 6:22 am
by dragancesu
I think the program should open a combox when it comes to this field,
Probably ON GOTFOCUS , but I do not know how to get control to open the list,
Control requires a click or cursor action
Re: How can I expand ComboBox via application
Posted: Fri Oct 19, 2018 6:33 am
by Rathinagiri
Yes. It can be done!
Consider this...
Code: Select all
define combobox usernames
row 10
col 160
width 330
sort .t.
fontsize nFontSize
fontname cFontName
fontbold lFontBold
ongotfocus comboboxdropdown()
items aUsers
end combobox
//
//
//
function comboboxdropdown
local nHandle := GetControlHandle (this.name,thiswindow.name)
ComboBoxShowDropDown(nHandle)
return nil
function comboboxdropdownclose( cWindowName, cControlName )
local nHandle
default cWindowName := this.name
default cControlName := thiswindow.name
nHandle := GetControlHandle ( cControlName , cWindowName )
ComboBoxShowDropDownClose( nHandle )
return nil
function ensuretopindex
local nHandle := GetControlHandle (this.name,thiswindow.name)
if this.value > 0
ComboBoxSetTopIndex(nHandle,this.value)
endif
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <commctrl.h>
#include "hbapi.h"
#include <wingdi.h>
HB_FUNC ( COMBOBOXSHOWDROPDOWN )
{
HWND hWnd1;
hWnd1 = (HWND) hb_parnl (1);
SendMessage((HWND) hWnd1,CB_SHOWDROPDOWN, (WPARAM)(int) 1,(LPARAM)(int) 0);
}
HB_FUNC ( COMBOBOXSHOWDROPDOWNCLOSE )
{
HWND hWnd1;
hWnd1 = (HWND) hb_parnl (1);
SendMessage((HWND) hWnd1,CB_SHOWDROPDOWN, (WPARAM)(int) 0,(LPARAM)(int) 0);
}
HB_FUNC ( COMBOBOXSETTOPINDEX )
{
HWND hWnd1;
hWnd1 = (HWND) hb_parnl (1);
hb_retni(SendMessage((HWND) hWnd1,CB_SETTOPINDEX, (WPARAM)(int) hb_parni(2) - 1,(LPARAM) 0 ));
}
#pragma ENDDUMP
Re: How can I expand ComboBox via application
Posted: Fri Oct 19, 2018 12:06 pm
by mol
Thank you! It works perfectly as I mentioned
