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 » Changing EditFields from header files
Re: Changing EditFields from header files [message #38081 is a reply to message #38079] Thu, 29 November 2012 20:34 Go to previous messageGo to previous message
navi is currently offline  navi
Messages: 107
Registered: February 2012
Location: Sydney, Australia
Experienced Member
[quote title=nlneilson wrote on Thu, 29 November 2012
maybe have
H1.h
void Set_t1(String a){ t1<<=a; }
H2.h
if ( a > b ) Set_t1("2 OK");

but get this error
H2.h(16) : error C3861: 'Set_t1': identifier not found
but in H1.h it is under public:
[/quote]

its not a valid scope to call Set_t1() this way. Set_t1 is in H1 Class scope so you need to call it using a object such as my_h1.Set_1();
but your H1 object is bound in main function and not accessible from global scope, since its only exist inside the main function.

// in h1.h file
struct H1 : public WithTest2Layout<TopWindow> {
public:
	typedef H1 CLASSNAME;
	H1();
	void AddNum(int a, int b){
		if(a>=b) 
			t1<<="1 OK";	
	}

        void AddNum2(int a, int b);
	void Set_t1(String a) {t1<<=a;}
};


// in h2.h file

#include "h1.h"

// it is now valid to call Set_t1 as AddNum2 is now also in the 
// same class scope.

void H1::AddNum2(int a, int b){
	if ( a > b )
//		t1<<="2 OK";
		Set_t1("2 OK");	

}






 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: hiding the vertical scrollbar of LineEdit Ctrl
Next Topic: Buttons in Array using ArrayCtrl
Goto Forum:
  


Current Time: Thu May 23 18:07:54 CEST 2024

Total time taken to generate the page: 0.02392 seconds