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 » U++ Library support » U++ Core » How to get value from parent AppWindow class?
Re: How to get value from parent AppWindow class? [message #43803 is a reply to message #43798] Mon, 20 October 2014 17:37 Go to previous message
mirek is currently offline  mirek
Messages: 14255
Registered: November 2005
Ultimate Member
akebee wrote on Thu, 16 October 2014 09:58
struct ChildAppWindow : TopWindow {
ChildAppWindow();
bool IsStop();
};

bool ChildAppWindow::IsStop()
{
// how can i cat bStop ( In class MyAppWindow)?
}

struct MyAppWindow : TopWindow {
MyAppWindow() ;

bool bStop;
void IsStop(bool& b) { b = bStop;}

ChildAppWindow child;

};

One way is like below:

Callback<bool&> cb_IsStop;
child.cb_IsStop = THISBACK(IsStop);

but this is not so convenient i think Crying or Very Sad



In cases like this, you can do 2 things:

a) put 'backpointer' MyAppWindow * into ChildAppWindow

b) Use GetOwner with dynamic_cast (but that only works if both windows are open and MyAppWindow owns ChildAppWindow. But with e.g. parent widget or TopWindow and child widget, it is quite good option

Mirek

Mirek
 
Read Message
Read Message
Previous Topic: XmlNode class is excellent
Next Topic: Problem with copy construction of std::vector from Upp::Vector
Goto Forum:
  


Current Time: Tue Apr 29 01:41:12 CEST 2025

Total time taken to generate the page: 0.03442 seconds