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 » Undeclared identifier
Undeclared identifier [message #37533] Mon, 15 October 2012 05:49 Go to next message
nejnadusho is currently offline  nejnadusho
Messages: 60
Registered: October 2012
Member
index.php?t=getfile&id=3892&private=0index.php?t=getfile&id=3891&private=0


Hi,

I am working on simple layout app.
Currently the app has one layout with a button and two edit boxes and a bunch of labels.

Practically it is the logIn page for the app.

I am trying to create an onFocus event where one of the labels disappear when the user clicks on the box to enter its username.
You can see it on one f the uploaded pictures.


On a click event I calling a function where setting the content of the label empty string. However I keep getting the following error messages. the labels name is 'usernameBox'

main.cpp
C:\MyApps\SProject\main.cpp(16) : error C2065: 'usernameBox' : undeclared identifier
C:\MyApps\SProject\main.cpp(16) : error C3861: 'SetLabel': identifier not found
SProject: 1 file(s) built in (0:03.16), 3167 msecs / file, duration = 3167 msecs, parallelization 0%

There were errors. (0:03.27)

And here how my code looks like

.h file
#ifndef _SProject_SProject_h
#define _SProject_SProject_h

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

#define LAYOUTFILE <SProject/SProject.lay>
#include <CtrlCore/lay.h>



class SProject : public WithSProjectLayout<TopWindow> {
	
public:
	void HideBoxText();
	typedef SProject CLASSNAME;
	SProject();
};

#endif




.cpp file

#include "SProject.h"





SProject::SProject()
{	
	CtrlLayout(*this, "Window title");
	Sizeable().Zoomable();
	
	logInButton <<= THISBACK(HideBoxText);
}

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

GUI_APP_MAIN
{
	SProject().Run();
}



.lay file

LAYOUT(SProjectLayout, 704, 524)
	ITEM(Button, logInButton, SetLabel(t_("LogInButton\aLogIn")).SetFont(StdFontZ(18).Bold().Italic()).SetFrame(FieldFrame()).LeftPosZ(304, 104).TopPosZ(420, 32))
	ITEM(EditField, LogInTxtBox, MaxChars(18).SetFont(StdFontZ(14)).SetFrame(FieldFrame()).WantFocus(false).LeftPosZ(268, 168).TopPosZ(292, 28))
	ITEM(Label, usernameBox, SetLabel(t_("\"UsernameBoxLabel\aUsername ")).SetFont(StdFontZ(12).Italic()).LeftPosZ(268, 164).TopPosZ(296, 21))
	ITEM(StaticText, dv___3, SetText(t_("Restaurant’s Easy One Solution")).SetFont(SansSerifZ(20).Bold()).LeftPosZ(192, 332).TopPosZ(104, 36))
	ITEM(StaticText, dv___4, SetText(t_("Welcome")).SetAlign(ALIGN_CENTER).SetFont(SansSerifZ(20).Bold()).LeftPosZ(184, 332).TopPosZ(64, 19))
	ITEM(StaticText, dv___5, SetText(t_("to")).SetAlign(ALIGN_CENTER).SetFont(SansSerifZ(20).Bold()).LeftPosZ(332, 40).TopPosZ(84, 19))
	ITEM(EditField, dv___6, SetFrame(FieldFrame()).WantFocus(false).LeftPosZ(268, 168).TopPosZ(324, 27))
	ITEM(Label, passwordBox, SetLabel(t_("Password")).SetFont(StdFontZ(12).Italic()).LeftPosZ(268, 125).TopPosZ(328, 21))
END_LAYOUT



Also how I set the name of the label you can see it in the


Any help will be greatly appreciated.

Thanks.
  • Attachment: layFile.jpg
    (Size: 44.50KB, Downloaded 387 times)
Re: Undeclared identifier [message #37536 is a reply to message #37533] Mon, 15 October 2012 07:08 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,

Here is you problem:
nejnadusho wrote on Mon, 15 October 2012 05:49

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



The HideBoxText is a global function, and usernameBox is a variable in SProject classs. You just forgot the "SProject::" Wink

Best regards,
Honza
Re: Undeclared identifier [message #37538 is a reply to message #37536] Mon, 15 October 2012 16:55 Go to previous message
nejnadusho is currently offline  nejnadusho
Messages: 60
Registered: October 2012
Member
WOW thanks a lot. Smile

Previous Topic: Dont underline letters in buttons
Next Topic: EditField.onFocus Event ?!?!?!
Goto Forum:
  


Current Time: Sun Apr 28 13:44:49 CEST 2024

Total time taken to generate the page: 0.04174 seconds