|
|
Home » Community » Newbie corner » Changing EditFields from header files
|
|
|
|
|
Re: Changing EditFields from header files [message #38085 is a reply to message #38084] |
Thu, 29 November 2012 22:26   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
In the first post the Test2.rar has a commented line I tried that also gave the:
// H1::t1 <<= "2 OK"; // error: 'H1' : is not a class or namespace name
I am on Win7 64bit running U++ 5556
On Win7 32bit and U++ 5584 the problems are the same.
Same with U++ 5592
I may have overlooked something so here it is with the last changes.
[Updated on: Thu, 29 November 2012 23:02] Report message to a moderator
|
|
|
|
|
|
Re: Changing EditFields from header files [message #38103 is a reply to message #38098] |
Fri, 30 November 2012 14:28   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Thanks navi
I tried the code and just get a pop up that says:
Assertion failed in C:\upp\uppsrc\CtrlCore\Ctrl.cpp, line 573
Gui widgets cannot be global variables
This is with both line 18 and 19 with each commemted one at a time.
Passing a String FROM H2.h will be fine into something like you suggested.
// void Set_t1(String a) {t1<<=a;}
edit: After Clean UPPOUT, CLEAN and rebuild it works with MSC9 optimal. Debug throws the error.
Same with MSC10, optimal OK and debug error
Much Thanks! That gives me something to work with.
[Updated on: Fri, 30 November 2012 15:20] Report message to a moderator
|
|
|
Re: Changing EditFields from header files [message #38104 is a reply to message #38081] |
Fri, 30 November 2012 18:35   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
nuvi:
in H1
Try2(*this);
in H2
H1 a;
void Try2(H1& a){
a.Set_t1("H2 OK");
}
That worked.
In a thread it could be:
a.Set_t1("H2 OK");
Sleep(1000);
a.Set_t1("H2 OK");
Sleep(1000);
...
The String in a.Set_t1("H2 OK"); would actually be a GPS NMEA sentence.
Fine except if it cannot be run in U++ Debug then it's a NoGo.
navi wrote on Thu, 29 November 2012 11:34 |
// 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");
}
|
I tried several variations of this.
H2.h
#include "H1.h"
void H1::Try2(){
Set_t1("H2 OK");
}
but in H1.h
//#include "H2.h" // this must be commented out
The t1 EditField shows "H2 OK" when run in Debug.
Thanks again, I have more than 20 hours tinkering with this.
[Updated on: Fri, 30 November 2012 21:32] Report message to a moderator
|
|
|
Re: Changing EditFields from header files [message #38105 is a reply to message #38104] |
Fri, 30 November 2012 21:21   |
navi
Messages: 107 Registered: February 2012 Location: Sydney, Australia
|
Experienced Member |
|
|
nlneilson wrote on Fri, 30 November 2012 18:35 | nuvi,
In a thread it could be:
a.Set_t1("H2 OK");
Sleep(1000);
a.Set_t1("H2 OK");
Sleep(1000);
...
|
I dont know if u r talking about U++ Thread class or not. if its U++ threads, then it is suggested not to change GUI from threads without proper care, GUI_Lock and PostCallback(). as chenging GUI from threads otherwise will end up in Gui Deadlock.
See the follwoings in example section:
GuiLock : This package demonstrates the use of Ctrl::Lock in MT applications
GuiMT : Using event queue for communication between worker threads and GUI
Quote: |
The String in a.Set_t1("H2 OK"); would actually be a GPS NMEA sentence.
Fine except if it cannot be run in U++ Debug then it's a NoGo.
|
dont know what u mean.
[Updated on: Fri, 30 November 2012 22:02] Report message to a moderator
|
|
|
|
Re: Changing EditFields from header files [message #38107 is a reply to message #38105] |
Fri, 30 November 2012 23:37  |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
I will look at the GuiLock and GuiMT links, thanks.
Going back through the Test2 and the code before that my biggest problem was not commenting out
#include "H2.h" in H1.h.
As you mentioned in Test4 Modified.rar
// must not include h2.h here as then it will have Try3(H1&) deffination
// befor H1's deffination hanse producing an scope error.
// invalid indentifier or somthing like that...
I probably would not have figured that out.
|
|
|
Goto Forum:
Current Time: Sun May 04 01:29:57 CEST 2025
Total time taken to generate the page: 0.03504 seconds
|
|
|