Home » U++ Library support » TopWindow&PopUp, TrayIcon » Modal vs non-modal window
Re: Modal vs non-modal window [message #11985 is a reply to message #11968] |
Sat, 06 October 2007 18:07   |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
mrjt wrote on Fri, 05 October 2007 06:09 |
class DataEntryWindow : public TopWindow
{
public:
typedef DataEntryWindow CLASSNAME;
// Sets the table name to update
DataEntryWindow &SetTableRecord(String table, int recordid);
// Links a DB field with a Ctrl
DataEntryWindow &SetDataSource(Ctrl &source, String field, Value intial_value, int datatype);
OnOK() { if (Accept()) { Commit(); OnCancelClose();} }
OnCancelClose() { delete this; }
private:
Commit(); // Builds SQL string using datasources and commits it to DB
};
could form the basis of a data enrty window that can be launched from a single function and then forgotten about:
void NewEmployee()
{
WithEmployeeLayout<DataEntryWindow> *wnd = new WithEmployeeLayout<DataEntryWindow>();
//Set tablename, datasources etc
wnd->Open(this);
}
|
Not that this is only a good idea if you have unlimited number of peer windows (like in UWord), preferably even main peer windows.
For modeless things, usually it is better to just make those subdialogs a member variables (no pointers); to open and close them as needed, no news and deletes involved. This also has the advantage that the content of dialog is accessible in the containing class, so there is often no need to transfer widget data to variables and back...
Mirek
|
|
|
 |
 |
Modal vs non-modal window
By: NeonN on Wed, 03 October 2007 20:13
|
 |
|
Re: Modal vs non-modal window
By: mrjt on Thu, 04 October 2007 13:08
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Thu, 04 October 2007 18:59
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Thu, 04 October 2007 20:08
|
 |
|
Re: Modal vs non-modal window
By: mrjt on Fri, 05 October 2007 12:09
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Fri, 05 October 2007 13:47
|
 |
|
Re: Modal vs non-modal window
By: mrjt on Fri, 05 October 2007 14:47
|
 |
|
Re: Modal vs non-modal window
By: mirek on Sat, 06 October 2007 18:07
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Sun, 07 October 2007 18:33
|
 |
|
Re: Modal vs non-modal window
By: mirek on Sun, 07 October 2007 19:37
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Sun, 07 October 2007 20:32
|
 |
|
Re: Modal vs non-modal window
By: mirek on Sun, 07 October 2007 23:46
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Mon, 08 October 2007 09:14
|
 |
|
Re: Modal vs non-modal window
By: mirek on Mon, 08 October 2007 10:52
|
 |
|
Re: Modal vs non-modal window
By: NeonN on Mon, 08 October 2007 14:58
|
 |
|
Re: Modal vs non-modal window
By: mirek on Sat, 06 October 2007 17:59
|
 |
|
Re: Modal vs non-modal window
By: exolon on Fri, 05 October 2007 11:55
|
Goto Forum:
Current Time: Sun Aug 24 19:44:10 CEST 2025
Total time taken to generate the page: 0.05066 seconds
|