Re: How to access a View in a Form

From: [at]} <gruntz{>
Date: Sun, 21 Feb 1999 12:07:33 +0100

>Another observation: the Tool and Aux dialogs introduce a hidden mode, since
>their appearance is the same, though functionality is fundamentally different
>(as shown by my buttons, which work in one mode but not the other).

>This is quite confusing in a "modeless" environment.
They have a different look&feel, in particular a different feel (under Windows):
- Tool windows cannot be minimized (i.e. they do not have minimize and
maximize buttons in the title => different look)
- Tool windows cannot be overlapped by another regular window, only by
other Tool windows, i.e. they cannot be put into the back (=> different feel)
- Tool windows can be moved outside the program window (in contrast to
the regular windows)


>> If you ask for the focus view in a command called from within a dialog,
>> the result depends on whether the dialog was opened as tool dialog or
>> as aux dialog. In the latter case, the dialog itself has the focus.
>> Containers.Focus returns the dialog itself and you can start
>> iterating over its content. Controllers.FocusView returns the view
>> which currently has the focus, and this is the push button currently
>> being pressed!
>> Note, that the latter can also be accessed via Controls.par.
>This means I can use view.context to get the enclosing view? Oh, no,context is
>something different. I thought there was a way to get at the
>enclosing container, what would solve the problem.

>
>I did not know. Another jewel that got buried in the docu.That's important piece
>of the puzzle. If I can jump from
>that button to an enclosing Form, I would know the starting point
>for the iteration.

your first thought was correct: Via the context of the button view, you
can access the model of the comtainer in which the button is embedded.
If you use Controls.par as a starting point, you always access over its
context the model of the container the control is embedded, independent
of whether the dialog is opened as tool or aux dialog.

For example, the following procedure moves a push button in a form if
it is activated over the button.

MODULE Test;

IMPORT Views, Models, Controls, FormModels, Ports;

PROCEDURE Do*;
  VAR v: Views.View; m: Models.Model;
BEGIN
  v := Controls.par;
  IF v # NIL THEN
   m := v.context.ThisModel();
   IF m IS FormModels.Model THEN
    m(FormModels.Model).Move(v, Ports.mm, 0)
   END;
  END
END Do;

END Test.




>But there is a better solution below.....
>
>
>> In case of a tool dialog, the focus is the focus of the window below the
>> tool dialog, e.g. a text (as for the Search&Replace dialog) or another
>> form (as for the property editor dialog).
>>
>> Thus, if you want to search for a view in a dialog then
>> 1) open the dialog as aux dialog
>> 2) execute c := Containers.Focus() to access the form controller
>> 3) look for the view you are searching for
>> c.GetFirstView(Controllers.any, v);
>> WHILE (v # NIL) & (v is not what you are looking for) DO
>> c.GetNextView(Controllers.any, v)
>> END
>>
>
>Great. That is what I will do.
>
>It just occured to me that your "(v is not what you are looking for)"
>in System-3 means a Gadget with a given name, that can be set
>interactively. In your Forms however names do not exist.
>The Properties item is greyed when I am launching Inspector
>on my GrView. Thus, if I happen to have TWO GrViews in the same
>form (why not?), I will have to introduce additional data field "name"
>in order to differentiate. This si however application-specific,
>and not supported in general by the environment.
that's right. But all controls do have a label at least. How to search
for a control with a given label is shown in the example Cuno posted.


>
>Even though I can do this and thus solve my particular problem,
>how about solving that in general in the next BB release?
What about a wrapper which adds a property name to a
view? Below you find a variant of ObxWrappers which adds
such a label. The type of the wrapper is exported so that you
can access the label and the wrapped view.

- Dominik


StdCoder.Decode ..,, ..0G,...3Qw7uP5PRPPNR9Rbf9b8R79FTvMf1GomCrlAy2xhX,Cb2x
 hXhC6FU1xhiZiVBhihgmRiioedhgrZcZRiXFfaqmSrtuGfa4700zdGrr8rmCLLCJuyKtYcZRiX
 7.2.s,s,d.,k,5TWyql.bnayKmKKqGomC5XzET1.PuP.MHT9N9ntumaU2,CJuyKtQC98P9PP7O
 NbXmb.2.geHk2kaC,,6.,U08J99SdfJHPNjvQCJuGKfaqmY6MwdONl1QCh0708T,U..wU.kv9,
 2U18J99SqorGqmQCbWBxhYFWUl1UnNHEWUmr.6.AzEk5ks1,,6.ku8.86.QC18RdfQHfMf9R9v
 Q7ONb17.,.D,,6.I12U.U,U.I3tfj1.0E65.oKAU0KyB.,Ub.,UOU.2Uz1,Ue.E.07M5c.3gwP
 .,6.A46.w16.M.,.DONRPNhPMmLT5.2UE0C.Q0QU0KyB.,Um,,UO.,.1.e0M.6YE.q.o1IUDU.
 A4QUoU.o..2NQUcU,I1,E.e7CEHk.U.QDAUQU.QRYU0KyBU.2.O62.e,2.AU.Ue6T6.2UwK.c,
 EGl,K1gAQUi.36.QUy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3W7,50.28Uc.H,a2Ui.UUQ2.WGs..MG.H,U7ICUiwBI505.Uv.Ui,..EIOpoK4RNORXmRbB
 A,HsE.U4VV,.H,m2..Ebg,66fePj1rV3pd2tH39S6Pk48ssHpmsETfP.sIdnVGLtmKWKqtCK.4
 D..umVy4.7ONbvM,kVkkUnp3cQ...sQR,.G20EtV.UIU.U72U.6.,..1cUXDJcIf9P9fQbf9bW
 GhigFWE.4Te.sQRdIf9P9HWE.8z,U.kJl1kFF.0U10.bf9bWHZitZhZZcZRiX3Ul1.RVtZBE.8
 z12U.6..F6.0Eh6.0.32.oZ,ZCUZ7F6.G.0..676.16.0U.UUQoO7.2Uwpr,6C5X,U,U.2.8Mt
 r.2..c6E.k.U6hggpiZZidRgV7TxR.0.,6Y1.0.UA2Tm.mmBjZAgYvob0Cy2xBgAsE..626..U
 6U..HE.6ZPuQWlJCO.0MyfU.az863X8OWNLW7Hx1...
 --- end of encoding ---
Received on Sun Feb 21 1999 - 12:20:32 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:42 UTC