2/27/2019 0 Comments Liberty Basic 4 Companion Games![]() Sovereignty Education and Defense Ministry (SEDM) Liberty University. Learn how to be free and sovereign. Log in with either your Library Card Number or EZ Login. Game Companion 2.4![]() Push Buttons - from © 2011, Alyce Watson. All rights reserved.||||||||||| Button A push button is a regular button. The user clicks on it to interact with a program. The button on the right in the image below is a push button. As with all other controls, buttons must be listed in the code before the window is opened. There are two kinds of buttons in Liberty BASIC, (regular) push buttons and BMPBUTTONS. The command to create push buttons must begin with the window handle, then a dot and a unique extension. Although the use of an extension is optional, omitting it isn't recommended, since that limits the program's ability to send commands to the button. In the following example, the window handle is '#1,' and the extension for this button is '.button1' Here is the format to include a button: BUTTON # 1.button1, 'I'm a Button!' , [branchLabel ], UL, _ xpos, ypos, width, height or BUTTON # 1.button1, 'I'm a Button!' , subName, UL, _ xpos, ypos, width, height The label that appears on the button is written between the quotation marks. After the button label, the button command must specify the branch label or sub name in the program where execution should continue when the button is pushed by the user. [branchLabel] or subName The UL designates a corner of the client area. ![]() (Client area is the area of the window that does not include the titlebar, menu or frame - the workspace of the window.) UL stands for upper left. The button appears at a distance specified from the upper left corner. The other possibilities are UR (upper right,) LL (lower left,) and LR (lower right.) The next number is the X position in relationship to the corner specified. The following number is the Y position. The last two numbers are optional. Use them to specify the desired width and height of the button for a uniform look to the buttons in a window. If the program does not specify dimensions, the button is sized automatically to the correct width and height for the label and font size chosen. Microsoft office 2010 cracked version torrent. If the font size of a button is changed during program execution, it may be necessary to change the size of the button also with the LOCATE command, since Liberty BASIC does not automatically resize the button. Default Button To create a button in a dialog window that will be activated when the user pushes ENTER, give it the extension DEFAULT as in this example: button # 1.default, 'OK', [ do.it ],UL, 10, 300 Non-literals in Button Statements Expressions and variables are also acceptable as parameters in the BUTTON command. Some examples follow. Buttonwidth = 2 * 60 button # 1.1, 'Open', [ open ],UL, 10, 20,buttonwidth, 40 button # 1.1, 'Edit', [edit ],UL, 200, 20,buttonwidth, 40 width = 60 height = 25 xOrigin = 10 yOrigin = 10 label$ = 'Button' bitmapFile$ = 'run.bmp' button #main.sized, label$ + ' Label!' , [click ], UL,_ xOrigin + 60, yOrigin, width * 3, height bmpbutton #main. Run, bitmapFile$, [ run ], UL, xOrigin, yOrigin bmpbutton #main.bug, 'bug.bmp', [bug ], UL, xOrigin, yOrigin * 4 EVENT HANDLERS Both branch labels and subs can be used to handle button events. If a sub is used, the handle of the button is passed into the sub by Liberty BASIC. It is passed in as a string variable. Refer to it by placing the # character in front of this handle variable, as in the demo below: button # 1.b, 'Click Me',clickMe,UL, 10, 10 button # 1.c, 'Pick Me', [pick ],UL, 10, 60 open 'duh' for window as # 1 wait [pick ] 'enable the other button # 1.b '!enable' wait Sub clickMe handle$ 'send a command to this button 'using handle variable #handle$ '!disable' End Sub COLORS The background color of a button is a system color.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |