View Single Post
Old 07-20-2017, 02:16 PM   #7
MSK
Human being with feelings
 
Join Date: Jan 2017
Posts: 43
Default

Quote:
Originally Posted by clau_ste View Post
I implemented this control and i found two problems

1. The text is not centered vertically and i can't figure out how to put it at the left of the IRECT

2. How can i get the text of this control if i have a pointer to it? Which function should i call?
Bump for #1. Has anyone made a text entry where the text is centered vertically? My only solution is to have the text entry have no background and draw my own offset background around it to manually make the text centered, which is less than ideal...

In response to #2, I'm not sure exactly what you were asking. If you mean get the text from inside the control, that's handled, like Oli said, by:

void TextFromTextEntry(const char* txt){}

If you mean how do you access the text from outside the control, you'd probably want to copy the text to an internal variable and write a GetText() method. Something like this:

Code:
char * storedText = "";
void TextFromTextEntry(const char* txt){

   //do something with the text
   storedText = txt;

}

char * GetText(){ return storedText; }
Then somewhere else you'd get it like this:
Code:
char * txt = pControl -> GetText();
MSK
MSK is offline   Reply With Quote