Modify Label with custom text nor working

General discussion on Visual GLCD Software.
Post Reply
Author
Message
Mihai Popa
Posts: 28
Joined: 20 Jul 2010 13:56

Modify Label with custom text nor working

#1 Post by Mihai Popa » 06 Feb 2018 22:33

Hello,

I work to an project and I want to modify the text from label without success.
I attached my code.
Please explain how should I proceed in order to modify the text from label.
I use MikroBasic, Visual GLCD and EasyPIC5 with PIC18F4550 at 8MHz.

Thank you,
Mihai
Attachments
Test 02-04-2018.zip
(205.35 KiB) Downloaded 120 times

User avatar
strahinja.jacimovic
mikroElektronika team
Posts: 200
Joined: 18 Dec 2017 18:19

Re: Modify Label with custom text nor working

#2 Post by strahinja.jacimovic » 08 Feb 2018 18:08

Hi,

Have you checked our examples from within the compiler?

There are a couple for GLCD where you can see how this is done.

Kind regards,
Strahinja Jacimovic

Mihai Popa
Posts: 28
Joined: 20 Jul 2010 13:56

Re: Modify Label with custom text nor working

#3 Post by Mihai Popa » 08 Feb 2018 18:28

Hello,

Thank you for response.
Yes, I checked and the examples from MikroBasic compiler work very well.
My problem is with Visual GLCD: the label text is not changed if I modify the follow lines:
Label1.Caption = @Label1_Caption
Label1_Caption = "qwer"
So, please, provide me an short example of this action.
Please see my attachment, maybe I am doing something wrong there.
And, your example is only for that big GLCD; I use the small one, 128x64.

Thank you,

Mihai

User avatar
strahinja.jacimovic
mikroElektronika team
Posts: 200
Joined: 18 Dec 2017 18:19

Re: Modify Label with custom text nor working

#4 Post by strahinja.jacimovic » 12 Feb 2018 16:15

Hi,

I was able to create a simple example.

Basically, it's the same as yours. I just added this piece of code in the events part.

Code: Select all

//--------------------- User code ---------------------//
void updateLabel(TLabel *lbl, char *str)
{
  Glcd_Write_Text_Adv(lbl->Caption, Label1.Left, Label1.Top);
  strcpy(lbl->Caption, str);
  DrawLabel(lbl);
}

//----------------- End of User code ------------------//

// Event Handlers
void Button1OnClick() 
{
  char str[20] = {'N','E','W'};
  updateLabel(&Label1,&str);
}
Basically, whenever I click on the button, the caption of the label will change to NEW.

I did this on a PICv7 board using PIC18F45K22, but it should work on yours as well.

Kind regards,
Strahinja Jacimovic

Mihai Popa
Posts: 28
Joined: 20 Jul 2010 13:56

Re: Modify Label with custom text nor working

#5 Post by Mihai Popa » 09 Mar 2018 06:55

Hello,
Thank you for your support.
It works!

Post Reply

Return to “Visual GLCD General”