FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


How to recover the contein of and editControl in form2 from an other form ?

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog
View previous topic :: View next topic  
Author Message
Tonton Luc



FRANCE (Le Touquet)
Joined: 16 Oct 2001
Posts: 1548

PostPosted: 10 Aug 2017 10:57    Post subject: How to recover the contein of and editControl in form2 from an other form ? Reply with quote

Hi,

Sorry, I don't remember how to do it.
Any sample ?

If my application have 2 forms (form1 + form2), and form2 have un editControl, how to recover the text of this editControl from a button in form1 ?
Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3104

PostPosted: 10 Aug 2017 14:03    Post subject: Reply with quote

I think it sounds like a quite strange thing to do.
  • What should happen if form1 is not open?
  • What should happen if there are two or more form1's open?
But anyway, your form1 interface should provide a predicate that an obtain the value of the edit control.

And then (and this where the questions above come in play) form2 should obtain the "relevant" form1 object somewhere and call the predicate from above.

_________________
Regards Thomas Linder Puls
Prolog Development Center
Back to top
View user's profile Send private message
Tonton Luc



FRANCE (Le Touquet)
Joined: 16 Oct 2001
Posts: 1548

PostPosted: 10 Aug 2017 14:20    Post subject: Reply with quote

Hummm... it's not clear for me.
I try to explain more.

From his onShow, the taskwin open the form1.

When the user click to the task menu, the taskwin display form2 and put it BringToTop (so form1 never closed).

I this case, how to obtein the contain of an editControl of form2 from form1 ?
Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3104

PostPosted: 10 Aug 2017 19:43    Post subject: Reply with quote

As mentioned above form1 should provide a predicate that can return the text:

interface form1 supports form
...
predicates
    getEditControlText : () -> string Text.
...
end interface

implement form1 ...

clauses
    getEditControlText() = editControl_ctl:getText().
...
end implement form1.

That is the simple part, the difficult part is how form2 should obtain form1, because in generel there are nothing that guarenties that there is one and only one instance of a certain form.

Your program may of course have some special properties that ensures that there is exactly one form1 open. But it will require that form1 cannot be closed, and that additional form1's cannot be opened.

In that case it seems relatively safe to assert the form in a class fact somewhere so that form2 can access it through that fact.
[/list]

_________________
Regards Thomas Linder Puls
Prolog Development Center
Back to top
View user's profile Send private message
Tonton Luc



FRANCE (Le Touquet)
Joined: 16 Oct 2001
Posts: 1548

PostPosted: 11 Aug 2017 6:52    Post subject: Reply with quote

Hi,

Asserting the form in a class fact => it was what I'm looking for.
All works fine now.

Many thanks Thomas.
Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum