Re: combobox,rowsource,displayvalue,controlsource by christophe
christophe
Tue Apr 15 05:53:18 CDT 2008
Hi,
I've marked with an ** which code i've added.
Then you'll see the behaviour I don't want.
I just add a combobox controlsource with a table.
PUBLIC oform1
CREATE CURSOR "test" (nummer C(10)) **
APPEND BLANK **
oform1=NEWOBJECT("form1")
oform1.Show()
RETURN
DEFINE CLASS form1 AS form
ADD OBJECT combo1 AS combobox WITH ;
boundto = .t.,; **
controlsource = "test.nummer",; **
RowSourceType = 3, ;
RowSource = "select * from temp into cursor (sys(2015))", ;
Height = 24, ;
Left = 72, ;
Top = 60, ;
Width = 100
ADD OBJECT text1 AS textbox WITH ;
Height = 23, ;
Left = 156, ;
Top = 156, ;
Width = 100, ;
Value = 'focus dummy'
PROCEDURE Load
LOCAL lnSelect
lnSelect = SELECT(0)
CREATE CURSOR temp (test C(10))
INDEX on test TAG test
FOR i = 1 TO 3
INSERT INTO temp VALUES (TRANSFORM(i))
ENDFOR
GO TOP
SELECT (m.lnSelect)
ENDPROC
PROCEDURE combo1.Valid
LOCAL lcValue
lcValue = TRIM(This.DisplayValue)
IF !EMPTY(m.lcValue) AND !INDEXSEEK(m.lcValue,.F.,'temp','test')
INSERT INTO temp VALUES (m.lcValue)
This.Requery()
ENDIF
ENDPROC
ENDDEFINE
--
Christophe Steyaert
Int. Repair Services Zeebrugge
L. Blondeellaan 5
8380 Zeebrugge
tel : 050 54 20 27
fax : 050 54 79 84
"Stefan Wuebbe" <stefan.wuebbe@gmx.de> schreef in bericht
news:u4LJDOunIHA.2328@TK2MSFTNGP03.phx.gbl...
>
> "christophe" <nothingtosend@empty.com> schrieb im Newsbeitrag
> news:ORbPmjtnIHA.4196@TK2MSFTNGP04.phx.gbl...
>> Stefan,
>>
>> I have put this code in the combo.valid()
>>
>> IF .not. seek(this.DisplayValue,"rowsourcetable")
>> INSERT INTO "rowsourcetable" (klantnr) VALUES (this.displayvalue)
>> this.Requery()
>> ENDIF
>>
>> but still it is blanked when leaving the combobox.
>> Although the rowsource is correct.
>
> The example.prg below works for me, same for you?
> If so, can you modify it to match your requirements and make it
> reproduce the misbehaviour you observed?
>
>
> hth
> -Stefan
>
>
>
> *
> PUBLIC oform1
> oform1=NEWOBJECT("form1")
> oform1.Show()
> RETURN
>
> DEFINE CLASS form1 AS form
> ADD OBJECT combo1 AS combobox WITH ;
> RowSourceType = 3, ;
> RowSource = "select * from temp into cursor (sys(2015))", ;
> Height = 24, ;
> Left = 72, ;
> Top = 60, ;
> Width = 100
>
> ADD OBJECT text1 AS textbox WITH ;
> Height = 23, ;
> Left = 156, ;
> Top = 156, ;
> Width = 100, ;
> Value = 'focus dummy'
>
> PROCEDURE Load
> LOCAL lnSelect
> lnSelect = SELECT(0)
> CREATE CURSOR temp (test C(10))
> INDEX on test TAG test
> FOR i = 1 TO 3
> INSERT INTO temp VALUES (TRANSFORM(i))
> ENDFOR
> GO TOP
> SELECT (m.lnSelect)
> ENDPROC
>
> PROCEDURE combo1.Valid
> LOCAL lcValue
> lcValue = TRIM(This.DisplayValue)
> IF !EMPTY(m.lcValue) AND !INDEXSEEK(m.lcValue,.F.,'temp','test')
> INSERT INTO temp VALUES (m.lcValue)
> This.Requery()
> ENDIF
> ENDPROC
> ENDDEFINE
> *
>
>
>
> --
> |\_/| ------ ProLib - programmers liberty -----------------
> (.. ) Our MVPs and MCPs make the Fox run....
> - / See us at www.prolib.de or www.AFPages.de
> -----------------------------------------------------------
>