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 ?
- Tonton Luc
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01
- Thomas Linder Puls
- VIP Member
- Posts: 1411
- Joined: 28 Feb 2000 0:01
I think it sounds like a quite strange thing to do.
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.
- What should happen if form1 is not open?
- What should happen if there are two or more form1's open?
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
PDC
PDC
- Tonton Luc
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01
- Thomas Linder Puls
- VIP Member
- Posts: 1411
- Joined: 28 Feb 2000 0:01
As mentioned above form1 should provide a predicate that can return the text:
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]
Code: Select all
interface form1 supports form
...
predicates
getEditControlText : () -> string Text.
...
end interface
implement form1 ...
clauses
getEditControlText() = editControl_ctl:getText().
...
end implement form1.
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
PDC
PDC
- Tonton Luc
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01