Switch to full style
@JeffKerr's library of BASIC! Graphics Mode functions.
Post a reply

Graphic Controls Generator/Handler

Fri Oct 21, 2011 11:08 am

** Admin note: This program is located in http://laughton.com/basic/programs/tools/GraphicControls/

Just uploaded a new version - see below for details of changes.
As a few icons have been been added I put all te files in a Folder called GraphicsInclude. Just download the folder contents and place the 3 .bas files in the Basic Source Folder and the 7 .png files in the Basic Data Folder.
The include requires the latest version (v1.33) of Basic! to run.
Please report any bugs or suggestions.

!*** v0.9 Changes
!*** # ModCtrlCap & ModCtrlData no longer update stored Caption$ or Data$ values
!*** for a control, they just use the text parameter to update displayed value.
!*** # Old entries not being cleared when ResetListBox function called.
!*** # Added two new functions HourGlass_Show(pStyle,pDisable) and HourGlass_Hide(pEnable)
!*** usefull for indicating an action is taking sometime.
!*** * The "pStyle" paramter determines which HourGlass icon will be shown (1=Starting,
!*** 2=Midway (default) or 3=Finished).
!*** * Setting the parameter "pDisable" to 1 will disbale ALL controls when HourGlass displayed.
!*** * Setting the parameter "pEnable" to 1 will reset ALL controls back to the state they were
!** in when the HourGlass was first dislayed.
!** * This disable/enable action can be used to prevent any user interaction taking place
!*** until processing is completed.
!*** * Touch Option Button "Show Wait" to demo display/hide Hourgalass functions
!*** separated by a 2 second pause.
!*** # Added Clip function to ListBox to truncate long listbox entries.
!*** # Added new styles for ListBox control - bcCHECKBOX$ and bcFILEDIALOG$.
!*** * If bcCHECKBOX$ style assigned then a CheckBox icon will added to the start of each entry.
!*** - The program will automatically prefix all ListBox entries with either "[_]" or "[X]" to
!*** indicate the entries checked status. Use function GetCtrlCap$ to retrieve updated entry
!*** list followed by Split function to access individal entries.
!*** - Touching the Checkbox Icon will toggle the CheckBox setting on and off.
!*** - Touch the "CheckBox" Option button on the Test Bed display to toggle between
!*** entries with and without CheckBoxes.
!*** * If bcFILEDIALOG$ style assigned then ListBox entries will be formatted as follows:
!*** - An Entry beginning with ".." with be displayed as is.
!*** - Entries ending with "(d)" will be displayed with a prefixed Folder style Icon
!*** and the trailing "(d)" text removed.
!*** - All other Entries will be displayed with a prefixed File style Icon.
!*** - Touch the "FileDialog" Option button on the Test Bed display to toggle between
!*** a "Normal" and "FileDialog" formatted ListBox.
!*** # Implemented minimum Height for Thumb Slider on ListBox vertical scroll bar.
!*** # Added new style to allow horizontal positioning of controls:
!*** * bcCTRLLEFT$ Draws Control offset left of screen centre by specified Left value.
!*** * bcCTRLCENTRE$ Draws Control at Centre of screen.
!*** * bcCTRLRIGHT$ Draws Control offset right of screen centre by specified Left value.
!*** # MsgBox$ can now display an icon alongside the message text, if required. Four icons
!*** are avaiable - Information, Question, Exclamation and Critical. See sample code and
!*** comments for details.
!*** # Added new style bc3DBorder$ - draws 3D style border around a control.
!*** Style applied to ListBox in Test Bed program.

Re: Graphic Controls Generator/Handler

Sun Oct 30, 2011 12:48 am

Just uploaded a new version (v1.00). Note folder and filename changes. Folder name is now "GraphicControls" (it was GraphicsInclude).

!*** v1.00 Changes
!*** # Changed Filenames. New Filenames are:
!*** - GraphicControls.bas (was GraphicsInclude.bas)
!*** - GraphicConstants.bas (was GraphicsConstants.bas)
!*** - GraphicControlsTestBed.bas (was GraphicsTesBed.bas)
!*** # Change to hide rather than gray out ListBox icons when ListBox control disabled.
!*** # Corrected bug where a Control Border defaulted to 3D style when no Style settings specified.
!*** # Added HideCtrl(pCtrlNo,pRender) and for completeness ShowCtrl(pCtrlNo,pRender).
!*** As the required processing required by ShowCtrl() is exactly the same as the existing
!*** EnableCtrl() routine, it simply calls that routine.
!*** # Added new button only style - bcGRAPHIC$. If used the control caption will be assumed to name
!*** the picture in the Basic! Data Folder to be drawn (sized and centered) on the button face.
!*** Picture name should include extension (i.e: "cartman.png" not just "cartman").
!*** Test Graphic Button added to bottom of TestBed panel.
!*** # Added new style - bcNOTCLICKABLE$. Stops Controls reacting to a touch event. Introduced mainly
!*** to prevent a picture used as a background being "clicked".
!*** # Reversed order controls are checked for a touch event. Previously search started with first control
!*** drawn and ended with last control drawn. New search starts with last control drawn and ends with
!*** first control drawn thus checking the controls in z-order (i.e.: foreground to background).
!*** This allows controls drawn on top of another control (e.g.: a picture) to be "clicked".
!*** # Added new style - bcHIDE$. Enables controls to be created hidden.

Re: Graphic Controls Generator/Handler

Sun Oct 30, 2011 4:12 pm

This library of graphic elements becomes better day by day...

Trying the File Dialog, i get only test entries..?

It will be nice to have real file access...

Whats about some simple programs to USE your beautiful commandset like i have suggested?
I am sorry: i am not very productive on BASIC for the moment...

Thanks, Oliver

Re: Graphic Controls Generator/Handler

Tue Nov 01, 2011 5:34 am

Thanks Jeff I will download the latest and get into it. I have gor that one project that can make really good use of this great tool.
I will let you know about the syntax problem when I get started again. right now I am bogged down with java.....@#$%

Re: Graphic Controls Generator/Handler

Tue Nov 01, 2011 11:28 pm

new here where do I get the link to the files?

Re: Graphic Controls Generator/Handler

Wed Nov 02, 2011 3:18 am

The details are in the first post in this Shared Programs section.

Re: Graphic Controls Generator/Handler

Thu Nov 03, 2011 1:50 pm

how do I get this. I am a newbe here. Thanks.

Re: Graphic Controls Generator/Handler

Thu Nov 03, 2011 6:49 pm

- open this link
- read it twice
- explore the ftp directory with an win ftp prg or
- download the downlad helper or dl helper plus or type the code from the page into a new bas file and save it
- start the dl helper within basic!, choose the code you want to use
- load the downloaded prg, start it
- have fun...

hope this helps,

Re: Graphic Controls Generator/Handler

Fri Nov 04, 2011 7:16 pm

You can explore the programs in the FTP directory from your browser:

I have made changes to the instructions to make some things more understandable.

Re: Graphic Controls Generator/Handler

Fri Nov 04, 2011 11:05 pm

Just uploaded a new version of the GraphicControls package - v1.01

v1.01 Changes
# Bug fixed - reworked control hide/show and enable/disable logic to handle situations where control
was already hidden or disabled (Hidden items were appearing after a gobal disable/enable control
cycle when HourGlass used). As a result of "nesting" disabled requests it is possible to loose track
and a control may not be enabled when instructed to do so. The pRender parameter on the EnableCtrl
command has been enhanced to overcome this problem. Setting pRender to 3 or 4 will force the control
to be enabled (i.e.: 3=Force Enable,4=Force Enable and do a gr.Render).
# Bug fixed - vertical/horizontal alignment of text in bcFRMDISPLAY, bcFRMFRAME and bcFRMLISTBOX controls.
Captions for these control should align correctly if bcALIGNLEFT$, bcAIGNCENTRE$ or bcALIGNRIGHT$ used.
If CtrlMiddle=0 on a bcFRMDISPLAY then only Data Text drawn using default left alignment.
If CtrlMiddle=CtrlWidth on a bcFRMDISPLAY then only Caption Text drawn using alignment styles.
# Change - If no filename specified for a bcFRMPICTURE control then "Question.png" will be used.
Bitmap needs to be created for future use and I don't know how to create an empty bitmap.
# Added new parameter to StartNewForm(pDateSize,pSound$). If the new pSound$ parameter is set to "Y"
a sound will be made each time a control is touched. Two new constants (bcSOUNDON$ amd bcSOUNDOFF$)
have been added.
# Added new function - SetSound(pSound$). Turns Sound on and off. Use bcSOUNDON$ and bcSOUNDOFF$
constants as parameter values.
# Added new ListBox style - bcLISTBOXRIGHT$. If used ListBox entries will be right aligned (useful for
numeric entries).
# Added new ListBox style - bcLISTBOXLAST$. If used then each time new ListBox Entry List is changed
(using the ResetListBox function) the ListBox will be drawn showing the last entries in the list
regardless of any selection.
# Added new style - bcDISABLED$. Enables controls to be created disabled.
# Included a sample program Calculator.bas that uses GraphicControls include. Uses above new ListBox
Styles. Calculator should auto size to fit screen size and orientaion.
# Altered ListBox on TestBed display to show actual file names and folders. Goto Parent Folder and
show children of a selected folder also work. Code to handle this is in the test bed program not
built into the GraphicControls.bas file. That way it could be customised to handle different
requirements (e.g.: Folder selection as opposed to File selection, selecting specific File Types,
etc.). Possibly a candidate for a new include GraphicStdDialogs.bas?
# Added code to auto switch between the large and small definitions based on screen size.
Post a reply