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++ Widgets - General questions or Mixed problems » How to call instance in main.cpp
Re: How to call instance in main.cpp [message #5131 is a reply to message #5129] Wed, 06 September 2006 17:45 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ulti wrote on Wed, 06 September 2006 11:17

well,that's hard to describe,let's see some code:

in main.cpp:
struct App : public TopWindow
{
ULeftCtrl Left;
URightCtrl Right;
....
CppSQLite3DB database;//that is another
String exeDML(const char* szSQL);
//this routine to parse szSQL and record every INSERT or UPDATE with acture ROWID.
....
}
GUI_APP_MAIN
{
App().Run();
}

in LeftCtrl.h(represent Left Pane) somewhere
want to call database.xxx and exeDML()

==================================================
static Vector<Ctrl *> Ctrl::GetTopCtrls();
static Vector<Ctrl *> Ctrl::GetTopWindows();

is that get App struct?

if not this not help,I can define database pointer in LeftCtrl.h and then in App::App() make this pointer point to database,but I got no idea with exeDML.I have to consider trigger or some other way.


What about to simply make things global? In the end AfxGetApp is an global variable (accessed via function) too.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: always-on-top window
Next Topic: StaticRect blocks mouse events - deliberate?
Goto Forum:
  


Current Time: Sun May 05 03:41:49 CEST 2024

Total time taken to generate the page: 0.02938 seconds