Managing screens

General discussion on Visual GLCD Software.
Post Reply
Author
Message
oliverb
Posts: 570
Joined: 24 May 2007 15:09

Managing screens

#1 Post by oliverb » 02 Apr 2019 13:45

If I have multiple screens, and my program is redrawing objects then is it my responsibility to check that an object is actually on the current screen before drawing it?

I was expecting objects on other screens to be treated as invisible but it seems they still draw.

User avatar
jovana.medakovic
mikroElektronika team
Posts: 986
Joined: 18 Dec 2018 10:36

Re: Managing screens

#2 Post by jovana.medakovic » 03 Apr 2019 13:19

Hello,

Could you zip and send me a minimal project which demonstrates these?
Can you tell me which development board you are using?

Kind regards,
Jovana

oliverb
Posts: 570
Joined: 24 May 2007 15:09

Re: Managing screens

#3 Post by oliverb » 03 Apr 2019 13:53

The development system is an Easypic4 with 18F4520. I'm using a keypad not a touch panel.
Program to follow, though I'll need to mess around with it so it will run without my add-ons.

Actually you shouldn't need an example, it is visible in the driver code:

Code: Select all

sub procedure UpdatePBPosition(dim AProgressBar as ^TProgressBar)
  if (AProgressBar^.Position <> AProgressBar^.Prev_Position) then
    Update_Sector(AProgressBar)
    Update_Percentage(AProgressBar)
    AProgressBar^.Prev_Position = AProgressBar^.Position
  end if
end sub
Funnily enough the code for the progress bar doesn't appear to check "Visible" either. I haven't actually confirmed this on hardware though, but it is observable in the source code.

Here's the code for drawing a label:

Code: Select all

sub procedure DrawLabel(dim ALabel as ^TLabel)
  if (ALabel^.Visible = 1) then
    Glcd_Set_Font_Adv(ALabel^.FontName, ALabel^.Font_Color, _GLCD_HORIZONTAL)
    Glcd_Write_Text_Adv(ALabel^.Caption, ALabel^.Left_, ALabel^.Top)
  end if
end sub
Now this doesn't check if it is on the current screen, but this may not matter. Labels would probably only ever be drawn by the screen draw code so the problem shouldn't occur in normal use.

Also note that (ALabel^.Visible = 1) only accepts "1" as true. Simply dropping the "=1" would make it able to accept "true" as well, making it more compatible with Mikrobasic.

In C the "=1" would probably be redundant anyway.


Regarding the radiobutton code:

Code: Select all

      Glcd_Circle(ARadioButton^.Left_ + ARadioButton^.Height / 2, ARadioButton^.Top + ARadioButton^.Height / 2, ARadioButton^.Height / 2, _clDraw)
      Glcd_Circle_Fill(ARadioButton^.Left_ + 1 + ARadioButton^.Height / 2, ARadioButton^.Top + 1 + ARadioButton^.Height / 2, (ARadioButton^.Height / 2) - 3, _clClear)
      if (ARadioButton^.Checked = 1) then
        Glcd_Circle_Fill(ARadioButton^.Left_ + ARadioButton^.Height / 2 , ARadioButton^.Top + ARadioButton^.Height / 2, ARadioButton^.Height / 2 - circleOffset - 1, _clDraw)
      end if
Note that the second circle draw has its centre offset by +1,+1. This shouldn't be there as the circles are meant to be concentric.

Regarding the request for additional controls what I'm asking for is probably just a number box, which could be made by taking the progress bar and removing the part that draws the bar so it just leaves a box with a number in.

Post Reply

Return to “Visual GLCD General”