FirstOne:
PROC ~ {
v: ViewerClasses.Viewer ¬ TiogaButtons.CreateViewer[info: [name: "First One", iconic: FALSE]];
Use formats and looks as you wish.
b: TiogaButtons.TiogaButton ¬ TiogaButtons.CreateButton[viewer: v, rope: "DoIt", format: "center", looks: "lb", proc: DisplayButton];
This line of buttons has the curious feature that "First" creates a button that is the whole node.
Use this technique to create a button, perhaps a bullet character from the Math font (look m),
that selects the entire contents of the button.
b ¬ TiogaButtons.CreateButton[viewer: v, rope: "First", proc: DisplayButton];
b ¬ TiogaButtons.AppendToButton[button: b, rope: " "];
b ¬ TiogaButtons.AppendToButton[button: b, rope: "Second", proc: DisplayButton];
b ¬ TiogaButtons.AppendToButton[button: b, rope: " "];
b ¬ TiogaButtons.AppendToButton[button: b, rope: "Third", proc: DisplayButton];
This line of buttons has an empty button without a proc.
All the other buttons are appended to the empty button and are individual.
Unlike the preceeding example, there is no way to select this node entirely.
b ¬ TiogaButtons.CreateButton[viewer: v, rope: ""];
b ¬ TiogaButtons.AppendToButton[button: b, rope: "First", proc: DisplayButton];
b ¬ TiogaButtons.AppendToButton[button: b, rope: " "];
b ¬ TiogaButtons.AppendToButton[button: b, rope: "Second", proc: DisplayButton];
b ¬ TiogaButtons.AppendToButton[button: b, rope: " "];
b ¬ TiogaButtons.AppendToButton[button: b, rope: "Third", proc: DisplayButton];
};
FSButtons:
PROC [fPattern:
ROPE] ~ {
PFSInfoProc:
PFS.InfoProc ~ {
InfoProc: TYPE = PROC [fullFName, attachedTo: PATH, created: BasicTime.GMT, bytes: INT, keep: CARDINAL] RETURNS [continue: BOOLEAN];
b: TiogaButtons.TiogaButton;
b ¬ TiogaButtons.CreateButton[viewer: v, rope: " ", format: "table", proc: DisplayButton];
b ¬ TiogaButtons.AppendToButton[button: b, rope: Convert.RopeFromTime[created], looks: "bs", proc: DisplayTime, clientData: NEW[MyTimeRec ¬ [created]]];
b ¬ TiogaButtons.AppendToButton[button: b, rope: "\t"];
b ¬ TiogaButtons.AppendToButton[button: b, rope: PFS.RopeFromPath[fullFName], proc: DisplayFileName];
IF NOT attachedTo.IsEmpty THEN {
b ← TiogaButtons.AppendToButton[button: b, rope: "\n"];
b ← TiogaButtons.AppendToButton[button: b, rope: attachedTo, looks: "s", proc: DisplayFileName];
};
RETURN [TRUE]
};
v: ViewerClasses.Viewer ¬ TiogaButtons.CreateViewer[info: [name: "FSButtons", iconic: TRUE]];
TiogaButtons.SetStyleFromRope[v, fancyTableStyle];
[] ¬ TiogaButtons.CreateButton[viewer: v, rope: "Clear", format: "Center", looks: "lb", proc: ClearMsgWindow];
[] ¬ TiogaButtons.CreateButton[viewer: v, rope: "XEROX", format: "logo"];
[] ¬ TiogaButtons.CreateButton[viewer: v, rope: ""];
PFS.EnumerateForInfo[PFS.PathFromRope[fPattern], PFSInfoProc];
ViewerOps.OpenIcon[v];
};
For fancy formatting of TiogaButtons, define your own style rules using the StyleDef property or TiogaOps.SetStyle and a style name other than the default style.
fancyTableStyle: ROPE ¬ "BeginStyle (Cedar) AttachStyle (table) \"fancy table\" { block 3 in restIndent 3 in flushLeft \".\" 8 congruent leaders tabStop } StyleRule EndStyle";
DisplayTime: TiogaButtons.TiogaButtonProc ~ {
timeRef: MyTime ¬ NARROW[button.clientData];
unpacked: BasicTime.Unpacked ¬ BasicTime.Unpack[timeRef.time];
MessageWindow.Append[Rope.Concat["This file created on a ",
SELECT unpacked.weekday
FROM
Monday => "Monday",
Tuesday => "Tuesday",
Wednesday => "Wednesday",
Thursday => "Thursday",
Friday => "Friday",
Saturday => "Saturday",
Sunday => "Sunday",
ENDCASE => "unknown day!"], TRUE];
};