Successfully upgraded to Vanilla Forums v2.6. Please report any issue you may find.

2.7-Window Flags

edited August 2017 in English
When a window is created you can set some flags to enable or disable the features listed below:

Resizeable
- Set to True to ensure that the window can be resized by the user (default), but if this flag is set to False window can not be resized.

Closeable
- Set to True to ensure that the window can be closed with the close gadget (default), otherwise the close gadget will be disabled.

Moveable
- Set to True to ensure that the window can be moved by the user (default), if set to False the window you can not be moved.

Borderless
- Set to True to create a borderless window, or set to False to create a standard one (the default setting).

Modal
- Set to True to create a modal window (always on top until it is cleared), or set to False to create a standard one (the default setting).

Hideable
- Set to True to ensure that the window can be reduced to an icon (default) or set to False to prevent iconification by the user.

Autoclose
- Set to True to immediately close the window when the close gadget is pressed (default) or set to false to ensure that the closure does not happen automatically, but that it is up to the programmer to do it immediately after receiving by a closure notice callback function.

As usual now we see an example to better understand this topic, you create a new script and enter the following code:

; Include the HGui library in our application and enable the debugging
@INCLUDE "yourpath/+Includes.hws"
@INCLUDE #INC_HGUI

DBG.Console.Enable(True, False)
DBG.Console.AddChannel(HGui.DebugChannel)
The following code will handle the creation of five windows. Each flag comes set differently and the setting of the flag will be shown in the window title:

; First window: prevent resizing
Local myWin1 = HGui.Window:new(
	{ title = "W1 : Can't be resized!",
	  name = "win1",
	  position = { x = 20, y = 20 },
	  size = { w = 300, h = 300 },
	  flags = { resizeable = False }
	  })

; Second window: prevent moving
Local myWin2 = HGui.Window:new(
	{ title = "W2 : Can't be moved!",
	  name = "win2",
	  position = { x = 50, y = 50 },
	  size = { w = 300, h = 300 },
	  flags = { moveable = False }
	  })

; Third window: prevent closing
Local myWin3 = HGui.Window:new(
	{ title = "W3 : Can't be closed!",
	  name = "win3",
	  position = { x = 80, y = 80 },
	  size = { w = 300, h = 300 },
	  flags = { closeable = False, autoclose = False }
	  })

; Fourth window: has no border
Local myWin4 = HGui.Window:new(
	{ title = "W4 : Borderless window!",
	  name = "wi4",
	  position = { x = 110, y = 110 },
	  size = { w = 300, h = 300 },
	  flags = { borderless = True }
	  })

; Fifth window: prevents iconification
Local myWin5 = HGui.Window:new(
	{ title = "W5 : Can't be hided!",
	  name = "win5",
	  position = { x = 140, y = 140 },
	  size = { w = 300, h = 300 },
	  flags = { hideable = False }
	  })

; Endless loop for the detection of events
Repeat
	WaitEvent()
Forever
Obviously flags can also be combined with each other. Just list them in the table "flags" with the desired value. Try to create some windows by setting multiple flags simultaneously.

Comments

Sign In or Register to comment.