Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SelStart and edit control
Message
De
15/04/1999 12:30:38
 
 
À
15/04/1999 10:47:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00208285
Message ID:
00208604
Vues:
25
Here is a prg illustrting a problem :

** this will create memo.dbf in c:\temp and then delete it
PUBLIC oform1
oform1=CREATEOBJECT("form1")
oform1.SHOW
RETURN

DEFINE CLASS de AS DataEnvironment
Name = "DE"
AutoCloseTables = .F.
AutoOpenTables = .T.
ADD OBJECT oCustomer AS cursor WITH ;
Alias = 'memo', ;
CursorSource = 'c:\vfp\memo.dbf'
ENDDEFINE


DEFINE CLASS myedit AS EDITBOX
CONTROLSOURCE = "MEMO.TEXT"
PROCEDURE KEYPRESS
PARAMETERS nKeyCode, nShiftAltCtrl
This.Parent.ShowId
ENDPROC
PROCEDURE CLICK
This.Parent.ShowId
ENDPROC
ENDDEFINE

DEFINE CLASS form1 AS FORM
AUTOCENTER = .T.
HEIGHT = 286
WIDTH = 355
CAPTION = "Edit Control Problem ?"
NAME = "Form1"
TOP = 0
LEFT = 0

ADD OBJECT LABEL1 AS LABEL WITH ;
CAPTION = "" ,;
HEIGHT = 37,;
LEFT = 36,;
TOP = 228,;
WIDTH = 264,;
NAME = "Label1"

ADD OBJECT edit1 AS MYEDIT WITH ;
HEIGHT = 169,;
LEFT = 36,;
TOP = 36,;
WIDTH = 265,;
NAME = "EDIT1"

PROCEDURE LOAD
SET DEFA TO C:\TEMP
SEP = CHR(13) + CHR(10)
CREATE TABLE MEMO FREE (TEXT MEMO)
INSERT INTO MEMO VALUES (;
"TEXT" + SEP + ;
"N ID1" + SEP + ;
"TEXT11" + SEP + ;
"TEXT12" + SEP + ;
"TEXT13" + SEP + ;
"N ID2" + SEP + ;
"TEXT21" + SEP + ;
"TEXT22" + SEP + ;
"TEXT23" + SEP + ;
"N ID3" + SEP + ;
"TEXT31" + SEP + ;
"TEXT32" + SEP + ;
"TEXT33" + SEP)
oDE = CREATEOBJECT("de")
oDe.init
ENDPROC

PROCEDURE SHOWID
y = left(Thisform.Edit1.Text, Thisform.Edit1.selStart)
n1 = rat(chr(13) + chr(10) + "N",y)
if n1 > 0
Thisform.Label1.caption = substr(Thisform.Edit1.Text,n1 + 4,3)
endif
ENDPROC
PROCEDURE DESTROY
USE IN MEMO
DELE FILE MEMO.DBF
DELE FILE MEMO.FPT
ENDPROC
ENDDEFINE

Now the problem is that when I click on line text21 the label will correctly show ID2, however if I use arrow down to get there, it won't show ID correctly.
I hope this makes sense. Of course I can use API to simulate clic, etc., but why should I ?
TIA,
Alex.
MS,MCP
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform