GUI - Container settings



These define the characteristics of the window that will contain your GUI elements.


VID DLS size

Sets the size of the window in pixels.

If you don't set a size, Red does it automatically.

As an interesting note, unless the window is big enough to show part of the title, you can't move (drag) it.


VID DLS title

Sets the title at top of the window.


VID DLS backdrop

Sets the background color of the window

 actors

Setting an icon

This only works if you compile the code! Does NOT work on interpreted code.

Not a container setting, but I think it fits here. If you want to set an icon to your window that is not the Red default, add icon: <path-to-icon> after the needs: 'view in the Red initial block:

Refinements

Containers (windows) allow the refinements options, flags, no-wait and tight. The refinements options and flags are defined in blocks after the view main block.

/options

In the options refinement you can determine your window's offset and size (size seems to be definable in both ways, as a container setting or an option).

  •  Offset determines where your window will show, measured from the top left of your screen.

/flags

  •  modal - modal window. Demands attention, disables all other windows until you close it.

Note: if you create a window that is modal and no-title/no-border, it is pretty hard to get rid of it, I had to use Task Manager.

  •  resize - the window can be resized.

  •  no-title - results in a rectangular frame with no title or buttons.

  •  no-border - results in a rectangular frame with no title or buttons and no border.

  •  no-min - only the close button is shown on window's top.

  •  no-max - the maximize button is shown as inactive.

  •  no-buttons - no window's buttons (maximize, minimize, close) are shown.

  •  popup - Windows only - makes the window a popup. It has a special styling (close button only) and allows other windows to stay active. Closes if you change focus to other windows.

/no-wait

From the documentation: "View: Render on screen a window from a face tree or a block of VID code. Enters an event loop unless /no-wait refinement is used.


That is, if you don't use no-wait, View will create a face and stay there waiting for events. If you use no-wait, Red will execute the View block (show the GUI) and keep going forward in the script.


Red [needs: view]

       

view/no-wait [button "Quit" [quit]]


print {This text would not have been printed

if you have removed the "no-wait" refinement.

That is because the interpreter would stay in

the View block waiting for events}


/tight


Zero offset and origin.


Default (without /tight):


Red [needs: view]

view[base]



With /tight:


Red [needs: view]

view/tight[base]




< Previous topic                                                                                          Next topic >