Drawing Screens And Components

Besides the user-defined event codes, you can also place a call to the drawing routines related a certain screens, which are an integral components of the Visual TFT.
These routines draw a desired screen as defined by a parameter.

Due to the different drawing approaches between the FT8xx controller and the rest of the supported controllers, drawing routines are organized as follows :

FT8xx Drawing Routines

Dynamic Screen Drawing Routines

mikroC Code

Routine Prototype Description Example
void DrawScreen(TScreen *aScreen); Draws a screen with all of its components in the following way :
  • If the current screen is equal to the screen passed via aScreen parameter (i.e. if the same screen is drawn as the current one), no GRAM resources will be updated.
  • If the current screen is not equal to the screen passed via aScreen parameter (i.e. if the drawn screen is not the same as the current one), all GRAM resources will be updated.
DrawScreen(&ScreenDemo);
void DrawScreenO(TScreen *aScreen, char aOptions); Draws a screen with all of its components with the following options passed as the aOptions parameter :
  • LDR_STATIC: Refresh all GRAM resources used by the components with the static property set to true (i.e. components that reside in Flash memory).
  • LDR_DYNAMIC: Refresh all GRAM resources used by the components with the static property set to false (i.e. components that reside in RAM).
  • LDR_ALL: Refresh all GRAM resources used by the components on the screen.
  • LDR_NONE: Don't refresh any of the GRAM resources used by the components on the screen.
Please, see this note also.
// Draw all components and refresh all GRAM resources used by the components on the screen
DrawScreenO(&ScreenDemo, LDR_ALL);

// Draw all components and refresh only GRAM resources used by the components that reside in RAM
DrawScreenO(&ScreenDemo, LDR_DYNAMIC);

mikroPascal Code

Routine Prototype Description Example
procedure DrawScreen(aScreen : ^TScreen) Draws a screen with all of its components in the following way :
  • If the current screen is equal to the screen passed via aScreen parameter (i.e. if the same screen is drawn as the current one), no GRAM resources will be updated.
  • If the current screen is not equal to the screen passed via aScreen parameter (i.e. if the drawn screen is not the same as the current one), all GRAM resources will be updated.
DrawScreen(@ScreenDemo);
procedure DrawScreenO(aScreen : ^TScreen, aOptions : byte); Draws a screen with all of its components with the following options passed as the aOptions parameter :
  • LDR_STATIC: Refresh all GRAM resources used by the components with the static property set to true (i.e. components that reside in Flash memory).
  • LDR_DYNAMIC: Refresh all GRAM resources used by the components with the static property set to false (i.e. components that reside in RAM).
  • LDR_ALL: Refresh all GRAM resources used by the components on the screen.
  • LDR_NONE: Don't refresh any of the GRAM resources used by the components on the screen.
Please, see this note also.
// Draw all components and refresh all GRAM resources used by the components on the screen
DrawScreenO(@ScreenDemo, LDR_ALL);

// Draw all components and refresh only GRAM resources used by the components that reside in RAM
DrawScreenO(@ScreenDemo, LDR_DYNAMIC);

mikroBasic Code

Routine Prototype Description Example
sub procedure DrawScreen(dim aScreen as ^TScreen) Draws a screen with all of its components in the following way :
  • If the current screen is equal to the screen passed via aScreen parameter (i.e. if the same screen is drawn as the current one), no GRAM resources will be updated.
  • If the current screen is not equal to the screen passed via aScreen parameter (i.e. if the drawn screen is not the same as the current one), all GRAM resources will be updated.
DrawScreen(@ScreenDemo)
sub procedure DrawScreenO(dim aScreen as ^TScreen, dim aOptions as byte) Draws a screen with all of its components with the following options passed as the aOptions parameter :
  • LDR_STATIC: Refresh all GRAM resources used by the components with the static property set to true (i.e. components that reside in Flash memory).
  • LDR_DYNAMIC: Refresh all GRAM resources used by the components with the static property set to false (i.e. components that reside in RAM).
  • LDR_ALL: Refresh all GRAM resources used by the components on the screen.
  • LDR_NONE: Don't refresh any of the GRAM resources used by the components on the screen.
Please, see this note also.
' Draw all components and refresh all GRAM resources used by the components on the screen
DrawScreenO(@ScreenDemo, LDR_ALL)

' Draw all components and refresh only GRAM resources used by the components that reside in RAM
DrawScreenO(@ScreenDemo, LDR_DYNAMIC)

Static Screen Drawing Routines

These routines are used if the static property of the screen has been set to true, i.e. the screen is placed in the FLASH memory :

mikroC Code

Routine Prototype Description Example
void DrawScreen(unsigned int aScreenID); Refer to the DrawScreen routine description above. DrawScreen(CScreenDemoScreenID);
void DrawScreenO(unsigned int aScreenID, char aOptions); Refer to the DrawScreenO routine description above. // Draw all components and refresh all GRAM resources used by the components on the screen
DrawScreenO(CScreenDemoScreenID, LDR_ALL);

// Draw all components and refresh only GRAM resources used by the components that reside in RAM
DrawScreenO(CScreenDemoScreenID, LDR_DYNAMIC);

mikroPascal Code

Routine Prototype Description Example
procedure DrawScreen(aScreenID : word); Refer to the DrawScreen routine description above. DrawScreen(CScreenDemoScreenID);
procedure DrawScreenO(aScreenID : word, aOptions : byte); Refer to the DrawScreenO routine description above. // Draw all components and refresh all GRAM resources used by the components on the screen
DrawScreenO(CScreenDemoScreenID, LDR_ALL);

// Draw all components and refresh only GRAM resources used by the components that reside in RAM
DrawScreenO(CScreenDemoScreenID, LDR_DYNAMIC);

mikroBasic Code

Routine Prototype Description Example
sub procedure DrawScreen(dim aScreenID as word) Refer to the DrawScreen routine description above. DrawScreen(CScreenDemoScreenID)
sub procedure DrawScreenO(dim aScreenID as word, dim aOptions as byte) Refer to the DrawScreenO routine description above. ' Draw all components and refresh all GRAM resources used by the components on the screen
DrawScreenO(CScreenDemoScreenID, LDR_ALL)

' Draw all components and refresh only GRAM resources used by the components that reside in RAM
DrawScreenO(CScreenDemoScreenID, LDR_DYNAMIC)

NoteNote

If the user changes properties of the dynamic compoment (i.e. a component that resides in RAM) that affects the GRAM resource, then the DrawScreenO function must be used to repaint the screen (aOptions parameter set to LDR_DYNAMIC).

Other Controller's Drawing Routines

Dynamic Objects Drawing Routines

The routines presented here are used if Dynamic property has been set :

mikroC Code

Routine Prototype Description Example
void DrawScreen(TScreen *aScreen); Draws A Screen. Please, see this note also. DrawScreen(&ScreenDemo);
void DrawLabel(TLabel *ALabel); Draws A Label. DrawLabel(&LabelDemo);
void DrawButton(TButton *AButton); Draws A Button. DrawButton(&ButtonDemo);
void DrawRoundButton(TButton_Round *Around_button); Draws A Rounded Button. DrawRoundButton(&RoundButtonDemo);
void DrawCircleButton(TCircleButton *ACircle_button); Draws A Circle Button. DrawCircleButton(&RoundCircleButtonDemo);
void DrawImage(TImage *AImage); Draws An Image. DrawImage(&ImageDemo);
void DrawCheckBox(TCheckBox *ACheckBox); Draws A Check Box. DrawCheckBox(&CheckBoxDemo);
void DrawRadioButton(TRadioButton *ARadioButton); Draws A Radio Button. DrawRadioButton(&RadioButtonDemo);
void DrawProgressBar(TProgressBar *AProgressBar); Draws A Progress Bar. DrawProgressBar(&ProgressBarDemo);
void UpdatePBPosition(TProgressBar *AProgressBar); Updates A Progress Bar Position. UpdatePBPosition(&ProgressBarDemo);
void DrawCircle(TCircle *ACircle); Draws A Circle. DrawCircle(&CircleDemo);
void DrawBox(TBox *ABox); Draws A Box. DrawBox(&BoxDemo);
void DrawRoundBox(TBox_Round *Around_box); Draws A Rounded Box. DrawRoundBox(&RoundBoxDemo);
void DrawLine(TLine *Aline); Draws A Line. DrawLine(&LineDemo);

mikroPascal Code

Routine Prototype Description Example
procedure DrawScreen(aScreen : ^TScreen); Draws A Screen. Please, see this note also. DrawScreen(@ScreenDemo);
procedure DrawLabel(ALabel : ^TLabel); Draws A Label. DrawLabel(@LabelDemo);
procedure DrawButton(Abutton : ^TButton); Draws A Button. DrawButton(@ButtonDemo);
procedure DrawRoundButton(Around_button : ^TButton_Round); Draws A Rounded Button. DrawRoundButton(@RoundButtonDemo);
procedure DrawCircleButton(ACircle_button : ^TCircleButton); Draws A Circle Button. DrawCircleButton(@RoundCircleButtonDemo);
procedure DrawImage(AImage : ^TImage); Draws An Image. DrawImage(@ImageDemo);
procedure DrawCheckBox(ACheckBox : ^TCheckBox); Draws A Check Box. DrawCheckBox(@CheckBoxDemo);
procedure DrawRadioButton(ARadioButton : ^TRadioButton); Draws A Radio Button. DrawRadioButton(@RadioButtonDemo);
procedure DrawProgressBar(AProgressBar : ^TProgressBar); Draws A Progress Bar. DrawProgressBar(@ProgressBarDemo);
procedure UpdatePBPosition(AProgressBar : ^TProgressBar); Updates A Progress Bar Position. UpdatePBPosition(@ProgressBarDemo);
procedure DrawCircle(ACircle : ^TCircle); Draws A Circle. DrawCircle(@CircleDemo);
procedure DrawBox(ACircle : ^TCircle); Draws A Box. DrawBox(@BoxDemo);
procedure DrawRoundBox(Around_box : ^TBox_Round); Draws A Rounded Box. DrawRoundBox(@RoundBoxDemo);
procedure DrawLine(Aline : ^TLine); Draws A Line. DrawLine(@LineDemo);

mikroBasic Code

Routine Prototype Description Example
sub procedure DrawScreen(dim aScreen as ^TScreen) Draws A Screen. Please, see this note also. DrawScreen(@ScreenDemo)
sub procedure DrawLabel(dim ALabel as ^TLabel) Draws A Label. DrawLabel(@LabelDemo)
sub procedure DrawButton(dim Abutton as ^TButton) Draws A Button. DrawButton(@ButtonDemo)
sub procedure DrawRoundButton(dim Around_button as ^TButton_Round) Draws A Rounded Button. DrawRoundButton(@RoundButtonDemo)
sub procedure DrawCircleButton(dim ACircle_button as ^TCircleButton ) Draws A Circle Button. DrawCircleButton(@RoundCircleButtonDemo)
sub procedure DrawImage(dim AImage as ^TImage) Draws An Image. DrawImage(@ImageDemo)
sub procedure DrawCheckBox(dim ACheckBox as ^TCheckBox) Draws A Check Box. DrawCheckBox(@CheckBoxDemo)
sub procedure DrawRadioButton(dim ARadioButton as ^TRadioButton) Draws A Radio Button. DrawRadioButton(@RadioButtonDemo)
sub procedure DrawProgressBar(dim AProgressBar as ^TProgressBar) Draws A Progress Bar. DrawProgressBar(@ProgressBarDemo)
sub procedure UpdatePBPosition(dim TProgressBar as ^AProgressBar) Updates A Progress Bar Position. UpdatePBPosition(@ProgressBarDemo)
sub procedure DrawCircle(dim ACircle as ^TCircle) Draws A Circle. DrawCircle(@CircleDemo)
sub procedure DrawBox(dim ABox as ^TBox) Draws A Box. DrawBox(@BoxDemo)
sub procedure DrawRoundBox(dim Around_box as ^TBox_Round) Draws A Rounded Box. DrawRoundBox(@RoundBoxDemo)
sub procedure DrawLine(dim Aline as ^TLine) Draws A Line. DrawLine(@LineDemo)

Static Objects Drawing Routines

The routines presented here are used if Static property has been set :

mikroC Code

Routine Prototype Description Example
void DrawScreen(unsigned int aScreenID); Draws A Screen. Please, see this note also. DrawScreen(CScreenDemoScreenID);
void DrawCLabel(TCLabel *AClabel); Draws A Label. DrawCLabel(&CLabelDemo);
void DrawCButton(TCButton *ACButton); Draws A Button. DrawCButton(&CButtonDemo);
void DrawCRoundButton(TCButton_Round *ACround_button); Draws A Rounded Button. DrawCRoundButton(&CRoundButtonDemo);
void DrawCCircleButton(TCCircleButton *ACcircle_button); Draws A Circle Button. DrawCCircleButton(&CRoundCircleButtonDemo);
void DrawCImage(TCImage *ACimage); Draws An Image. DrawCImage(&CImageDemo);
void DrawCCircle(CButton_Round *ACround_button); Draws A Circle. DrawCCircle(&CCircleDemo);
void DrawCBox(TCBox *ACbox); Draws A Box. DrawCBox(&CBoxDemo);
void DrawCRoundBox(TCBox_Round *ACround_box); Draws A Rounded Box. DrawCRoundBox(&CRoundBoxDemo);
void DrawCLine(TCLine *ACLine); Draws A Line. DrawCLine(&CLineDemo);

mikroPascal Code

Routine Prototype Description Example
procedure DrawScreen(aScreenID : word); Draws A Screen. Please, see this note also. DrawScreen(CScreenDemoScreenID);
procedure DrawCLabel(ALabel : ^TCLabel); Draws A Label. DrawCLabel(@CLabelDemo);
procedure DrawCButton(Abutton : ^TCButton); Draws A Button. DrawCButton(@CButtonDemo);
procedure DrawCRoundButton(Around_button : ^TCButton_Round); Draws A Rounded Button. DrawCRoundButton(@CRoundButtonDemo);
procedure DrawCCircleButton(ACircle_button : ^TCCircleButton); Draws A Circle Button. DrawCCircleButton(@CRoundCircleButtonDemo);
procedure DrawCImage(AImage : ^TCImage); Draws An Image. DrawCImage(@CImageDemo);
procedure DrawCCircle(ACircle : ^TCCircle); Draws A Circle. DrawCCircle(@CCircleDemo);
procedure DrawCBox(ABox : ^TCBox); Draws A Box. DrawCBox(@CBoxDemo);
procedure DrawCRoundBox(Around_box : ^TCBox_Round); Draws A Rounded Box. DrawCRoundBox(@CRoundBoxDemo);
procedure DrawCLine(Aline : ^TCLine); Draws A Line. DrawCLine(@CLineDemo);

mikroBasic Code

Routine Prototype Description Example
sub procedure DrawScreen(dim aScreenID as word) Draws A Screen. Please, see this note also. DrawScreen(CScreenDemoScreenID)
sub procedure DrawCLabel(dim ALabel as ^TCLabel) Draws A Label. DrawCLabel(@CLabelDemo)
sub procedure DrawCButton(dim Abutton as ^TCButton) Draws A Button. DrawCButton(@CButtonDemo)
sub procedure DrawCRoundButton(dim Around_button as ^TCButton_Round) Draws A Rounded Button. DrawCRoundButton(@CRoundButtonDemo)
sub procedure DrawCCircleButton(dim ACircle_button as ^TCCircleButton) Draws A Circle Button. DrawCCircleButton(@CRoundCircleButtonDemo)
sub procedure DrawCImage(dim AImage as ^TCImage) Draws An Image. DrawCImage(@CImageDemo)
sub procedure DrawCCircle(dim ACircle as ^TCCircle) Draws A Circle. DrawCCircle(@CCircleDemo)
sub procedure DrawCBox(dim ABox as ^TCBox) Draws A Box. DrawCBox(@CBoxDemo)
sub procedure DrawCRoundBox(dim Around_box as ^TCBox_Round) Draws A Rounded Box. DrawCRoundBox(@CRoundBoxDemo)
sub procedure DrawCLine(dim Aline as ^TCLine) Draws A Line. DrawCLine(@CLineDemo)

NoteNote

If one of the multiple screens in the project is declared as static, all screens should be drawn using DrawScreen routine for static property.

Copyright (c) 2002-2017 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!