Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Paste into an editbox in another form
Message
De
07/01/2004 19:00:48
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00864380
Message ID:
00864908
Vues:
16
My bad - the error actually occurred one line before that, when I'm assigning seltext. The .lostfocus was there to make sure the controlsource gets updated by custom code - you figured it right.

Now the whole problem here (VFP7.1) is that I'm passing a bound editbox as a parameter, and fiddling with its value in a form which runs in a different datasession - which is giving me trouble. Playing further with this, I noticed that the .text, .seltext, .value also had strange values when seen from the code in the called form. Somehow the bound control loses conection with its controlsource when its source-related properties are accessed (or assigned) in a different datasession. Don't know if this still holds in VFP8 - and I don't remember this mentioned anywhere as a bug.

The solution was simple: since I was using a commandbutton to launch this second form, I added the .selstart, .sellength, .seltext and .value properties to it (had to subclass the button, and to do it programmatically, for some reason), and in its .click I copied them from the editbox, and called the form passing the button as a parameter. On exit, the called form adjusted these properties the way I wanted it to, and the button copied the properties back to the editbox. The only trouble was that this called form is not modal, so I had to do this copy back in button's refresh - and I had to make sure that the button.parent.activate code had a this.refresh() in it.

>Why are you explicitly calling LostFocus() in the first place? That's only going to execute overridden code alogn the class hierarchy. It's not going to trigger the event or the Valid which is where the control value is committed to the ControlSource.
>
>>I have this scenario: a button passes its sibling editbox as a parameter (i.e. they have a common parent) to another form's method. The editbox is then referenced as a property of this second form. This second form is a search form; once the search is done, there's a button to paste the found string into the caller. The code to do that follows:
>>
If Not Isnull(Thisform.ocaller)
>>	lcLink=Thisform.MakeLink()
>>	Thisform.ocaller.SelText=lcLink
>>	Thisform.ocaller.lostfocus  && < -- here
>>	thisform.ocaller.SetFocus
>>	Thisform.ocaller=Null
>>	thisform.hide()
>>Endif
>>Sometimes, in the marked line, I get a "the record is read-only". Not always; on some editboxes it happens always, on some never, on some sometimes - go figure.
>>
>>Could this have anything to do with the editbox which always fails being bound to a field in an updatable view, while others are bound to fields in tables? All forms have private datasessions. Does it have to do something with writing a value to a bound control which lives in another datasession?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform