Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combobox dropdown width
Message
 
À
13/06/2013 14:14:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01576281
Message ID:
01576347
Vues:
36
>>>>>>>>>Hi All,
>>>>>>>>>
>>>>>>>>>Forgotten - is there a way to set the max width of the dropdown list of a combobox?
>>>>>>>>
>>>>>>>>ColumnWidths
>>>>>>>
>>>>>>>Hi Borislav, i tried that but it didnt work. My row source is wide and extends beyond my ColumnWidths value. Do I need to set something else?
>>>>>>
>>>>>>How many columns you have and what width you want :-)
>>>>>
>>>>>1 column, 300 pixels which is the same as the combobox itself.
>>>>
>>>>What happens when you set ColumnWidths to 300?
>>>
>>>The same as if I leave it empty - the dropdown list extends far to the right (reflecting the underlying 120 character field to which it is bound).
>>
>>You want it smaller or wider?
>>BTW you should set Columns to 1 also :-)
>
>I would like the dropdown area to be the same width as the combobox itself i.e. 300 pixels.


Christian has the answer:
oForm = CREATEOBJECT("form1")
oForm.Show(1)


DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT combo1 AS combobox WITH ;
		Height = 24, ;
		Left = 9, ;
		Top = 15, ;
		Width = 294, ;
		Name = "Combo1"


	PROCEDURE Init
		thisform.Combo1.RowSourceType= 6 
		thisform.Combo1.RowSource = "crsTest.Fld1"
		thisform.Combo1.ColumnCount = 2
		thisform.Combo1.ColumnLines = .f.
		thisform.Combo1.ColumnWidths = TRANSFORM(thisform.Combo1.Width-50)+",0" && Play with values here
	ENDPROC


	PROCEDURE Load
		CREATE CURSOR crsTest (Fld1 C(120))
		FOR lnFor = 1 TO 20
		    INSERT INTO crsTest VALUES(REPLICATE("A",lnFor))
		NEXT
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform