The Height property in Combo Boxes

Date:17 November 1999
Product/Release:LANSA for Windows
Abstract:The Height property in Combo boxes
Submitted By:LANSA Technical Support
Last Review:November 2010

How can a Visual LANSA user change the Height property of a combo box?

Whenever the Height of a combo box is changed from the default of 20 and the user then tabs off the property, the default is set back to 20. This behaviour is actually correct. The reason is that there is an integral height which must be maintained to ensure that the list entries do not display incorrectly. For example, consider a combo box with 3 entries on the list A, B and C. A is the current item in the edit box part of the combo box. The standard Height of the combo box will be fixed to the size of the font plus a border around the font so that only the entry A can be seen. If the height of the combobox was increased then it would be possible to see A plus the top half of B. This would not look correct.

It is possible, however , make the combo box height increase by increasing the size of the font. For example, create another combo box and drag #std_text field into the combo box. If the VisualStyle property of the combo box is now set to be VS_LARGE, then the size of the combo box will increase accordingly to fit in the new larger text.

The same rules apply for the rows in list views and grids.

Please copy the RDMLX source into an empty form to see a working example of the way that the Height property increases or decreases according to the font used in combo boxes and lists.

* *************************************************;
* ;
* COMPONENT: STD_FORM ;
* ;
* **************************************************;
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM HEIGHT(376) LEFT(280) TOP(117) WIDTH(482);
DEFINE_COM CLASS(#PRIM_LTVW) NAME(#LTVW_1) DISPLAYPOSITION(1) HEIGHT(193) LEFT(12) PARENT(#COM_OWNER) TABPOSITION(1) TOP(16) WIDTH(213);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_1) DISPLAYPOSITION(2) HEIGHT(193) LEFT(240) PARENT(#COM_OWNER) TABPOSITION(2) TOP(16) WIDTH(225);
DEFINE_COM CLASS(#PRIM_CMBX) NAME(#CMBX_1) DISPLAYPOSITION(3) LEFT(168) PARENT(#COM_OWNER) TABPOSITION(3) TOP(221) VALUE('ABCDEFGHIJKLMNOPQRST');
DEFINE_COM CLASS(#PRIM_STBR) NAME(#STBR_1) DISPLAYPOSITION(4) HEIGHT(24) LEFT(0) MESSAGEPOSITION(1) PARENT(#COM_OWNER) TABPOSITION(4) TABSTOP(False) TOP(325) WIDTH(474);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_1) DISPLAYPOSITION(1) PARENT(#LTVW_1) SOURCE(#DEPTMENT) WIDTH(30);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_2) DISPLAYPOSITION(2) PARENT(#LTVW_1) SOURCE(#DEPTDESC) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_1) DISPLAYPOSITION(1) PARENT(#GRID_1) SOURCE(#DEPTMENT) WIDTH(30);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_2) DISPLAYPOSITION(2) PARENT(#GRID_1) SOURCE(#DEPTDESC) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_CBCL) NAME(#CBCL_1) PARENT(#CMBX_1) SOURCE(#DEPTMENT) VISIBLE(False) WIDTH(20);
DEFINE_COM CLASS(#PRIM_CBCL) NAME(#CBCL_2) DISPLAYPOSITION(1) PARENT(#CMBX_1) SOURCE(#DEPTDESC) WIDTH(20);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) DISPLAYPOSITION(5) HEIGHT(72) LAYOUTMANAGER(#FWLM_1) LEFT(16) PARENT(#COM_OWNER) TABPOSITION(5) TABSTOP(False) TOP(249) WIDTH(449);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_1) FLOWOPERATION(Center) FLOWOPERATIONHOR(Spread);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#LARGE) CAPTION('Large Font ') DISPLAYPOSITION(1) LEFT(94) PARENT(#GPBX_1) TABPOSITION(1) TOP(31);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_1) MANAGE(#LARGE) PARENT(#FWLM_1);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_2) PARENT(#FWLM_1);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#NORMAL) CAPTION('Normal Font ') DISPLAYPOSITION(2) LEFT(274) PARENT(#GPBX_1) TABPOSITION(2) TOP(31);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_3) MANAGE(#NORMAL) PARENT(#FWLM_1);

EVTROUTINE HANDLING(#COM_OWNER.Initialize) OPTIONS
(*NOCLEARMESSAGES *NOCLEARERRORS);
select (#deptment #deptdesc) deptab;
ADD_ENTRY TO_LIST(#LTVW_1);
ADD_ENTRY TO_LIST(#grid_1);
ADD_ENTRY TO_LIST(#cmbx_1);
set #cmbx_1.currentitem focus(true);
endselect;
ENDROUTINE;

* Set the font in the combo box, list view and grid back to normal;
EVTROUTINE HANDLING(#NORMAL.Click);
set (#grid_1 #ltvw_1 #cmbx_1) visualstyle(#vs_norm);
MESSAGE MSGTXT('Visual Style sheet set to normal');
ENDROUTINE;

* Set the font in the combo box, list view and grid back to large;
EVTROUTINE HANDLING(#LARGE.Click);
set (#grid_1 #ltvw_1 #cmbx_1) visualstyle(#vs_large);
MESSAGE MSGTXT('Visual Style sheet set to large font');
ENDROUTINE;
END_COM;