Greetings V-TFT Users,
I have a early tip-of-the-month for May posting for you all. I think this one can really help you when you are working on your V-TFT project in your compiler.
(If you do not already do something similar)
This one helps you keep track of which V-TFT object (component) drawing routines you may need to call for the objects you used in your V-TFT project.
(the code examples are for
mBASIC, but
mC and
mPASCAL versions should be close to same)
STEP 1. Find the drawing routines external declarations in your V-TFT projects "
driver" file. You can refer to the tutorial PDF for more info on the driver file.
With your project loaded into your compiler and the projects driver file also loaded for viewing/editing, starting at the top of the file you will see the
modules name, then any other
file includes,
then
external declarations (these should be a listing of all object/button event handler routines you set in V-TFT).
After the
externals should be a grouping of
routine forwards declarations of all routines
V-TFT placed in the
driver file that
are or might be required for your project,
based on which components
you used in your project.
Here is an example driver file code listing of one of my projects that did not use too many different components:
Code: Select all
module PWM_PIC32_H2O_Cell_driver
include PWM_PIC32_H2O_Cell_objects
include PWM_PIC32_H2O_Cell_resources
' External Declarations *(shortened for this example - Robert)
sub procedure Scrn1_Btn_GATE10_OnClick() external
sub procedure Scrn1_Btn_PULSE10_OnClick() external
sub procedure Scrn1_Btn_PWM_OnClick() external
'/////////////////////////
sub procedure DrawScreen(dim aScreenID as word) '* these first 4 routines are required for your project and always listed here.
sub procedure Process_TP_Press(dim X as word, dim Y as word)
sub procedure Check_TP()
sub procedure Start_TP()
sub procedure DrawButton(dim Abutton as ^TButton) '* Here are the routines V-TFT thinks you will need for your projects objects. Copy the ones your project has.
sub procedure DrawCButton(dim Abutton as ^TCButton)
sub procedure DrawRoundButton(dim Around_button as ^TButton_Round)
sub procedure DrawCRoundButton(dim Around_button as ^TCButton_Round)
sub procedure DrawCLabel(dim ALabel as ^TCLabel)
sub procedure DrawCBox(dim ABox as ^TCBox)
sub procedure DrawRoundBox(dim Around_box as ^TBox_Round)
sub procedure DrawCheckBox(dim ACheckBox as ^TCheckBox)
sub procedure DrawProgressBar(dim AProgressBar as ^TProgressBar)
sub procedure UpdatePBPosition(dim AProgressBar as ^TProgressBar)
STEP 2. Copy all drawing routines your project has listed like shown above in my example code (drag pointer from start to end lines to highlight all of them and right-click - Copy.)
You should also copy the "sub procedure DrawScreen(dim aScreenID as word)" declaration too.
Or copy all lines from the drawscreen() entry to the last line entry, and remove the unneeded routines after pasting in the next step.
STEP 3. Paste the routine declarations you copied in
step 2 into your projects "
events_code" file in the '-------------- User code declarations ---------------'
section, (near the top of the file and below that comment line), so you will see something like this:
Code: Select all
'-------------- User code declarations ---------------'
sub procedure DrawScreen(dim aScreenID as word)
sub procedure Process_TP_Press(dim X as word, dim Y as word)
sub procedure Check_TP()
sub procedure Start_TP()
sub procedure DrawButton(dim Abutton as ^TButton)
sub procedure DrawCButton(dim Abutton as ^TCButton)
sub procedure DrawRoundButton(dim Around_button as ^TButton_Round)
sub procedure DrawCRoundButton(dim Around_button as ^TCButton_Round)
sub procedure DrawCLabel(dim ALabel as ^TCLabel)
sub procedure DrawCBox(dim ABox as ^TCBox)
sub procedure DrawRoundBox(dim Around_box as ^TBox_Round)
sub procedure DrawCheckBox(dim ACheckBox as ^TCheckBox)
sub procedure DrawProgressBar(dim AProgressBar as ^TProgressBar)
sub procedure UpdatePBPosition(dim AProgressBar as ^TProgressBar)
STEP 4. Edit the stuff you just pasted so it looks something like this:
(You can copy my comment line ' LIST OF V-TFT OBJECT DRAWING ROUTINES USED BY THIS PROGRAM: and use it if you want also.)
Code: Select all
'-------------- User code declarations ---------------'
' LIST OF V-TFT OBJECT DRAWING ROUTINES USED BY THIS PROGRAM:
' DrawScreen()
' DrawButton(@)
' DrawCButton(@)
' DrawRoundButton(@)
' DrawCRoundButton(@)
' DrawCLabel(@)
' DrawCBox(@)
' DrawRoundBox(@)
' DrawCheckBox(@)
' DrawProgressBar(@)
' UpdatePBPosition(@)
Making them comments and removing the ones you won't be calling (
start_TP(), Check_TP(), Process_TP_Press(dim X as word, dim Y as word) ).
Now you can easily copy the prototype routine call and paste them where you need them and fill (copy/paste) in the objects identifier name after the "
@" inside the parentheses.
Example:
DrawRoundButton(@RoundButton1)
Drawing Routine you want to use copied from the comments you made.
Object in your project you need to be drawn or redrawn (copy the name from elsewhere in the code, why type it or try to remember its name
),
and paste it after the
@ symbol, and ding - your done setting up the proper object drawing routine.
Also: If you did not know this, the drawing routines that have a Capitol "C" in the routine name are the drawing routines for "Static" components.
Make sure you use the right one for the object(s) you are wanting to draw/redraw.
Examples:
DrawButton(@) is the drawing routine for
Dynamic Buttons.
DrawCButton(@) is the drawing routine for
Static Buttons. ("
C" =
Constant, and this naming convention is used thru out the V-TFT generated code.)
Bonus Tip: Where to find the
V-TFT assigned name(s) for any screens in your project- (the proper screen identifier to be used with the "DrawScreen(
screennameScreenID)" routine.)
Load your V-TFT projects "
objects" file into the compiler, then scroll to the bottom of the file and you will see the proper V-TFT assigned constant (if static), identifier(s) for your screen(s).
They should be just above the "
Implements" statement like this:
Code: Select all
const Screen1ScreenID = 32768
const Screen2ScreenID = 32769
const Screen3ScreenID = 32770
implements
You may want to copy these also and place them in the "
events_code" file also as comments for later reference.
I hope this helps you with your projects and you find it useful, Robert.