Re: Forms captions

Guy Laden (laden@math.tau.ac.il)
Thu, 30 May 1996 05:27:41 +0300 (GMT+0300)

Hi,

> 1. What is the purpose of link to a caption in a form? I would like
> to design a form in which a caption is dynamic, taking its value
> from a string variable. Is that the purpose of a link to a
> a caption? I want a caption that cannot be manipulated by the
> user but that can be set by the program.

I dont know what a caption control's link property should be used for.
Regarding how to change the caption at runtime, I assume you mean the caption
control's label. If so, the following seems to work:

(* Add this routine to a menu. To use, select a Caption control and run
the routine via the menu *)
PROCEDURE ModifyCaptionLabel*;
VAR
poll: Controllers.PollOpsMsg;
pollMsg: Properties.PollMsg; setMsg: Properties.SetMsg;

BEGIN

Controllers.PollOps(poll);
IF poll.singleton # NIL THEN
Views.HandlePropMsg(poll.singleton, pollMsg);
pollMsg.prop(Controls.Prop).label := "new label";
setMsg.prop := pollMsg.prop; setMsg.old := NIL;
Views.HandlePropMsg(poll.singleton, setMsg);
ELSE Dialog.Beep
END
END ModifyCaptionLabel;

In a real application, one would probably have to travese a FormModel
using a FormReader to find the caption view.

> 2. What is the purpose of the label of a variable field in a form?

In the Controls documentation it is said that the label is not applicable to
(text, date, time and color) fields, list boxes, selection boxes, and
combo boxes. Also, in the documentation for DevInspector it is said that a
label is only valid for command buttons, check boxes, radio buttons, captions,
groups.

Best Regards,
Guy.