Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » EditField.onFocus Event ?!?!?!
EditField.onFocus Event ?!?!?! [message #37539] Mon, 15 October 2012 17:19 Go to next message
nejnadusho is currently offline  nejnadusho
Messages: 60
Registered: October 2012
Member
Hi there, Smile

I am trying to achieve a pre-fill input textBox like the one in the picture at the bottom.

I could not find such function. Is there one?

So for that I just put a label inside the input textBox/EditField and I want to make it disappear whenever someone focuses on it and appear whenever looses focus.

For that I am attempting the following but it does not work.

SProject::SProject()
{	
	CtrlLayout(*this, "Window title");
	Sizeable().Zoomable();
	
        //LogInTxtBox is the EditField tool name
	if (LogInTxtBox.FocusCtrl()){HideBoxText();}

        //or
        LogInTxtBox.Focus() <<= THISBACK(HideBoxText);
}

void SProject::HideBoxText(){
	usernameBox.SetLabel("");	
}



And BTW is the EditField the right tool to use for an inputBox?
How can I extract the input text from an EditField?

Thank you a lot.

nejnio
index.php?t=getfile&id=3893&private=0
  • Attachment: logIn.jpg
    (Size: 10.70KB, Downloaded 284 times)
Re: EditField.onFocus Event ?!?!?! [message #37541 is a reply to message #37539] Mon, 15 October 2012 19:38 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi nejnio

Judging by your description and your pictures, I believe that you are trying to achieve something that is already implemented in all the EditField based widgets Wink

Have a look at the NullText() method. In your case, put something like this in a constructor:
LogInTxtBox.NullText("Username");
Now you can forgot about hiding and showing the labels and the widget will paint it all for you for free. Is this the functionality you were looking for?

Best regards,
Honza
Re: EditField.onFocus Event ?!?!?! [message #37546 is a reply to message #37541] Tue, 16 October 2012 03:24 Go to previous message
nejnadusho is currently offline  nejnadusho
Messages: 60
Registered: October 2012
Member
Honza,

You rock! Smile

wow I killed crazy amount of hours to think on this simple problem.


Thank you very much once again.

Best,
nejnio
Previous Topic: Undeclared identifier
Next Topic: What's wrong now ? CtrlLayout
Goto Forum:
  


Current Time: Sun Apr 28 10:23:49 CEST 2024

Total time taken to generate the page: 0.96606 seconds