Help with Visual GLCD Text modes

General discussion on Visual GLCD Software.
Post Reply
Author
Message
mehamerly
Posts: 11
Joined: 07 Jan 2016 22:37

Help with Visual GLCD Text modes

#1 Post by mehamerly » 12 May 2016 03:54

I have created a label in VGLCD, and I am using it for numeric entry to display a password a user enters. I am having a lot of problems with this.
First - has anyone written code to enter a 4 digit password that allows access to another screen. this would help me out a lot...

I tried copying the SmartGLDC example, but I am still having problems. I want to erase a caption box when the user enters too many characters or hits the cancel button, but I cannot get the caption to clear. I t looks like it only 'ORs' the bits with any new ones.
Here is the code snippet I am using:

void Key_pressed(char letter_pressed){
unsigned short text_length;
char res[2] = " ";

text_length = strlen(typed_letters);
if (text_length >= 4) {
strcpy(lPWLabel_Caption, " ");
strcpy(typed_letters, "");
DrawLabel(&lPWLabel);
return;
}
res[0] = letter_pressed;
strcat(typed_letters, res);

strcpy(lPWLabel_Caption, typed_letters);
DrawLabel(&lPWLabel);
}


The DrawLabel function that gets called is this:

void DrawLabel(TLabel *ALabel) {
if (ALabel->Visible == 1) {
T6963C_Set_Font_Adv(ALabel->FontName, ALabel->Font_Color, _T6963C_HORIZONTAL);
T6963C_Write_Text_Adv(ALabel->Caption, ALabel->Left, ALabel->Top);
}
}


In Mikroe's example, they use:
void DrawLabel(TLabel *Alabel) {
T6963C_write_text(Alabel->Caption, Alabel->Left / 8,
Alabel->Top / 8, T6963C_ROM_MODE_XOR);
}

Which uses T6963C_write_text instead of T6963C_write_text_Adv
Could this be the problem?

How do you clear the bits on the display??

Thanks
Mike

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: Help with Visual GLCD Text modes

#2 Post by biljana.nedeljkovic » 13 May 2016 16:15

Hello,

Can you send me the exact example code you are comparing your code to?

Best regards,
Biljana

mehamerly
Posts: 11
Joined: 07 Jan 2016 22:37

Re: Help with Visual GLCD Text modes

#3 Post by mehamerly » 13 May 2016 16:22

Biljana

I will get the code, but the question may be an easy one.
When you have a label, and write to the caption, how do you erase it and start over?
When I change the string I write to the caption, it does not clear the previous characters, and seems to do an 'OR' function with the display - leaving the only pixels on and simply adding any new ones. I tried writing a string of spaces, but this does not work. The old characters stay on the display.

How do you clear the old characters out?

Mike

User avatar
biljana.nedeljkovic
mikroElektronika team
Posts: 1043
Joined: 30 Jun 2015 15:15

Re: Help with Visual GLCD Text modes

#4 Post by biljana.nedeljkovic » 16 May 2016 16:27

Hello,

You can write the same character in white, and then write the new value.

You can take a look at some of the examples that are available in the Visual GLCD.
"C:\Users\Public\Documents\Mikroelektronika\Visual GLCD\Projects\SmartGLCD_240x128_Demo_Code\mikroC PRO for PIC"

This one uses T6963C_Write_Text_Adv you wanted, and also demonstrates writing in white.

Best regards,
Biljana

Post Reply

Return to “Visual GLCD General”