Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drop down doesn't show width correctly first time
Message
From
18/02/2016 00:34:43
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01631636
Message ID:
01631642
Views:
57
>Hi everybody,
>
>I have a pageframe with 6 pages. On the first page I have a combobox. The first time I open this combobox it doesn't show the correct width for all items. If I select the longest item which is at the bottom (the drop down has only 8 items), then next time it shows OK.
>
>What can I do in order for it to show properly the first time?
>
>In the picture you'll see non-default properties for this combo.
>
>Thanks in advance.


Would it help to Cast() the width, like an SQL "'Select CAST(whatever As Char(50)), ... Into Array This.yourArrayProperty", or to set combo.ColumnWidths explicitly as in the following sample?
LOCAL oForm as Form
oForm = CREATEOBJECT('TestForm')
oForm.Show(1)
RETURN

DEFINE CLASS TestForm as Form
	AutoCenter = .T.
	PROCEDURE Load
		CREATE CURSOR temp (test C(254))
		LOCAL i
		FOR i = 1 TO 10
			INSERT INTO temp VALUES (CHR(i+64))
		ENDFOR
		GO TOP IN temp
	ENDPROC

	ADD OBJECT Combo1 as TestCombo WITH ;
		Left = 50, Top = 50

	ADD OBJECT Combo2 as TestCombo WITH ;
		Left = 200, Top = 50, ;
		ColumnCount = 2, ;
		ColumnWidths = '100,0', ;
		ColumnLines = .F.

	ADD OBJECT Combo3 as TestCombo WITH ;
		Left = 200, Top = 80, ;
		RowSource = 'Select CAST(test As Char(50)) From temp Into Cursor SYS(2015)'
ENDDEFINE

DEFINE CLASS TestCombo as ComboBox
	RowSource = 'Select test From temp Into Cursor SYS(2015)'
	RowSourceType = 3
ENDDEFINE
hth
-Stefan
Previous
Reply
Map
View

Click here to load this message in the networking platform