Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening combobox on the specific item
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01120459
Message ID:
01121447
Views:
8
This should fire ProgramaticChange() (but not tested)

>Hi Borislav,
>
>I just found out, that if I have only one item in the list, the InteractiveChange of the combobox doesn't fire! Perhaps it's because of the code in DropDown. I'm going to add some code to not do seek if I have just one item.
>
>>>Hi everybody,
>>>
>>>I have two comboboxes with Insurance Carriers. When I select an item in the first combobox and open the second combobox, I'd like to be positioned on the nearest item.
>>>
>>>Do you know how can I achieve this functionality?
>>>
>>>In other words, I only want to be positioned when I open the combobox. This combobox has a cursor as its source.
>>>
>>>Thanks in advance.
>>
>>Something like that?
>>
>>oForm = CREATEOBJECT([Form1])
>>oForm.Show()
>>READ EVENTS
>>
>>DEFINE CLASS form1 AS form
>>
>>
>>	Top = 0
>>	Left = 0
>>	Height = 111
>>	Width = 242
>>	DoCreate = .T.
>>	Name = "form1"
>>
>>
>>	ADD OBJECT combo1 AS combobox WITH ;
>>		Height = 24, ;
>>		Left = 29, ;
>>		Style = 2, ;
>>		Top = 22, ;
>>		Width = 179, ;
>>		Name = "Combo1"
>>
>>
>>	ADD OBJECT combo2 AS combobox WITH ;
>>		Height = 24, ;
>>		Left = 32, ;
>>		Style = 2, ;
>>		Top = 63, ;
>>		Width = 176, ;
>>		Name = "Combo2"
>>
>>
>>	PROCEDURE Load
>>		CREATE CURSOR crsCmb1 (Fld1 C(20), fld2 I)
>>		CREATE CURSOR crsCmb2 (Fld1 C(20), fld2 I)
>>		FOR asd = 1 TO 30
>>		    INSERT INTO crsCmb1 VALUES ([Fld ]+TRANSFORM(asd),asd)
>>		    IF asd % 2 == 0
>>		       INSERT INTO crsCmb2 VALUES ([Fld ]+TRANSFORM(asd),asd)
>>		    ENDIF
>>		NEXT
>>
>>		SELECT crsCmb2
>>		INDEX ON Fld2 TAG crsCmb2
>>	ENDPROC
>>
>>
>>	PROCEDURE Init
>>		thisform.Combo1.RowSourceType = 6
>>		thisform.Combo1.RowSource     = [crsCmb1.Fld1, Fld2]
>>		thisform.Combo1.BoundColumn   = 2
>>		thisform.Combo1.BoundTo       = .t.
>>		thisform.Combo1.Value         = 0
>>
>>		thisform.Combo2.RowSourceType = 6
>>		thisform.Combo2.RowSource     = [crsCmb2.Fld1, Fld2]
>>		thisform.Combo2.BoundColumn   = 2
>>		thisform.Combo2.BoundTo       = .t.
>>		thisform.Combo2.Value         = 0
>>	ENDPROC
>>
>>
>>	PROCEDURE combo2.DropDown
>>		IF thisform.Combo1.Value # 0
>>		   SET NEAR ON
>>		   SEEK thisform.Combo1.Value IN crsCmb2
>>		   SET NEAR OFF
>>		   this.Value = crsCmb2.Fld2
>>		ENDIF
>>	ENDPROC
>>
>>        PROCEDURE Destroy
>>             CLEAR EVENTS
>>        ENDIF
>>
>>ENDDEFINE
>>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform