>Dear Experts:
>
>I want to change something in a View. The following
>procedure works from the menu, but it does not work
>when I attach it to a button in a form:
>
>PROCEDURE FixCaptions*;
>VAR
> v: GrViews.View;
>BEGIN
> v := GrViews.Focus();
> IF (v # NIL) THEN
> (* do something *)
>
>It works from the menu, but does not seem to work when
>the GrView is embedded in a Form together with the Button.
>It looks like the focus view is then the whole Form,
>not the sub-view. This does make sense. So, how do I
>make it work?
BlackBox supports two focus paths, namely a target and a
front focus. The target path defines which view is the target
of commands in dialogs. The front path defines which view
is being edited, via mouse, keyboard, or menus. You want
to access the target view, therefore you have to use a
tool dialog instead of an auxiliary dialog. With auxiliary
dialogs, front and target is the dialog itself, whereas for
tool dialogs the two paths are different.
>I looked at Forms docu and it does not seem to discuss
>control --> View communication, and in particular how to
>locate a given view in the form. Then I looked at Controllers,
>and also did not find an (easy) answer.
If your view is a control, there is no problem as you can simply
change the data the control is linked at and call a Dialog.Update.
Other views have to be searched in the form. Access the focus
container using Containers.Focus and then iterate over its
content using the methods GetFirstView and GetNextView until
you found what you are looking for (e.g. a view of a particular
type or a control with a particular label).
Hope this helps,
- Dominik
Dr. Dominik Gruntz Oberon microsystems, Inc.
gruntz{([at]})nowhere.xy
voice ++41-1-445-1751 CH-8005 Zurich
fax ++41-1-445-1752
http://www.oberon.ch
Received on Fri Feb 19 1999 - 10:01:59 UTC