Liberty BASIC Help Online

STYLEBITS
stylebits #handle, addBits, removeBits, addExtendedBits, removeExtendedBits
 
Description:
STYLEBITS allows you to change the style of a Liberty BASIC window or control. It accepts a handle and four parameters. When the window is opened it checks to see if there are style bits for the window or for any controls. If there is a STYLEBITS command it applies the remove bits first, then applies the add bits. In this way the control is created from the get-go with the desired style. The STYLEBITS command must be issued before the command to open the window.
 
This command works on all Liberty BASIC windows and controls, but since the texteditor is not a native Windows control you will only be able to do things like tweak it's border and perhaps a few other things.
 
Some common window and control styles are listed below. To find all possible style bits used to create controls in Windows, refer to API references online or in books for the functions to CreateWindow and CreateWindowEx.
#handle
This must be a handle of handle variable that refers to a control. See the code below for a demonstration.
 
addBits
This contains all style bits that should be added to the control. If there are more than one, they must be put together with the bitwise OR operator, like this: _ES_AUTOVSCROLL or _ES_MULTILINE
 
removeBits
This removes style bits from the control. To remove a border from a control, this value would be _WS_BORDER.
 
addExtendedBits
This adds bits to the extended style. Windows created with an extended style have extended style bits, like _WS_EX_CLIENTEDGE.
 
removeExtendedBits
This removes bits from the extended style. Windows created with an extended style have extended style bits, like _WS_EX_TOOLWINDOW.
 
 
Usage:
  'here is a textbox with a password setting
  stylebits #main.pw, _ES_PASSWORD, _ES_AUTOVSCROLL or _ES_MULTILINE, 0, 0
  textbox #main.pw, 10, 10, 250, 25
 
  'here is one right justified, and we use a handle variable
  justHandle$ = "#main.rjust"
  stylebits #justHandle$, _ES_RIGHT, 0, 0, 0
  textbox #main.rjust, 10, 40, 250, 25
 
  'here's a silly example of twiddling style bits for a window
  stylebits #main, _WS_SYSMENU, _WS_POPUP, _WS_EX_CONTEXTHELP, 0
  open "STYLEBITS demo" for window_popup as #main
  #main.pw "please"
  #main.rjust "on the right"
  wait
 
WINDOW AND CONTROL STYLE CONSTANTS
window styles - some also work for controls:
_WS_BORDER        Creates a window that has a thin-line border.
_WS_CAPTION        Creates a window that has a title bar (includes the WS_BORDER style).
_WS_HSCROLL       Creates a window that has a horizontal scroll bar.
_WS_MAXIMIZE        Creates a window that is initially maximized.
_WS_MAXIMIZEBOX        Creates a window that has a Maximize button.
_WS_MINIMIZE        Creates a window that is initially minimized. Same as the WS_ICONIC style.
_WS_MINIMIZEBOX        Creates a window that has a Minimize button.
_WS_VSCROLL        Creates a window that has a vertical scroll bar.
 
button styles:
_BS_LEFT        Left-justifies the text in the button rectangle.
_BS_RIGHT        Right-justifies text in the button rectangle.
_BS_RIGHTBUTTON        Positions a radio button's circle or a check box's square on the right side of the button rectangle.
 
editbox (textbox) styles:
_ES_CENTER        Centers text in a multiline edit control.
_ES_PASSWORD        Displays an asterisk (*) for each character typed into the edit control.
_ES_RIGHT        Right-aligns text in a multiline edit control.
 
listbox styles:
_LBS_MULTICOLUMN        Specifies a multicolumn list box that is scrolled horizontally.
_LBS_SORT        Sorts strings in the list box alphabetically.
 
statictext styles:
_SS_CENTER        Specifies a simple rectangle and centers the text in the rectangle.
_SS_RIGHT        Specifies a simple rectangle and right-aligns the given text in the rectangle.


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/