[GUI] DG::Palette disappears
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-11-11 05:49 AM - last edited on ‎2023-08-04 04:16 PM by Doreena Deng
‎2007-11-11
05:49 AM
Hello,
When i use DG::ModalDialog and run method Invoke() my GUI stays on top of the window and message processing system works fine. But when i use DG::Palette (i need it, because I have to have possibility to select items during plug-in is running) there is no Invoke method:/ I've try:
GDLInterface inherits from DG::Palette.
BUT my interface disappears immediately after in shows up.
How can I use palette? Should it be running in thread?
GUI is turned on from menu.
Maciek
When i use DG::ModalDialog and run method Invoke() my GUI stays on top of the window and message processing system works fine. But when i use DG::Palette (i need it, because I have to have possibility to select items during plug-in is running) there is no Invoke method:/ I've try:
GDLInterface gdlInterface; gdlInterface.Activate(); gdlInterface.BeginEventProcessing(); gdlInterface.Show(); gdlInterface.BringToFront();
GDLInterface inherits from DG::Palette.
BUT my interface disappears immediately after in shows up.
How can I use palette? Should it be running in thread?
GUI is turned on from menu.
Maciek
Labels:
- Labels:
-
Add-On (C++)
3 REPLIES 3
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-11-27 07:47 PM
‎2007-11-27
07:47 PM
Hello.
I still haven't found solution of my problem. These objects for creating dialog boxes are great. But only for modal dialogs. With Palette which inherits from ModelessBase it's not.
I've try to use pointers, but ArchiCAD crashes.
I haven't found any functions, like RegisterPalette, and I really need to make it working.
Did anyone wrote plugin which uses palette as main window and make it working??
Main problem is that I wrote a lot of code which uses object oriented dialog manager. It works fine with DG::ModalDialog, but with DG::Palette don't, because Palette is destroyed right after it was created... Please help...
I still haven't found solution of my problem. These objects for creating dialog boxes are great. But only for modal dialogs. With Palette which inherits from ModelessBase it's not.
GSErrCode __ACENV_CALL CommandHandler (const API_MenuParams * params) { switch(params->menuItemRef.menuResID) { case 32500: switch(params->menuItemRef.itemIndex) { case 1: { // <-- here Palette should show DG::Rect rect; rect.Set(10, 10, 100, 100); DG::Palette palette(rect); palette.BeginEventProcessing(); palette.Show(); // here destructor works, like it should, and palette closes } } } return NoError; } // CommandHandler ()
I've try to use pointers, but ArchiCAD crashes.
I haven't found any functions, like RegisterPalette, and I really need to make it working.
Did anyone wrote plugin which uses palette as main window and make it working??
Main problem is that I wrote a lot of code which uses object oriented dialog manager. It works fine with DG::ModalDialog, but with DG::Palette don't, because Palette is destroyed right after it was created... Please help...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-11-27 11:05 PM
‎2007-11-27
11:05 PM
bamboos wrote:I'm guessing the reason for the problem is that the palette object has to persist outside of the scope of the menu-handler callback. Modal dialogs don't have this problem because you're finished with the dialog before returning from the callback.
I still haven't found solution of my problem. These objects for creating dialog boxes are great. But only for modal dialogs. With Palette which inherits from ModelessBase it's not.
[...]
I've try to use pointers, but ArchiCAD crashes.
Did anyone wrote plugin which uses palette as main window and make it working?? Main problem is that I wrote a lot of code which uses object oriented dialog manager. It works fine with DG::ModalDialog, but with DG::Palette don't, because Palette is destroyed right after it was created... Please help...
You're on the right track using a pointer, but I suspect you haven't allocated memory for the object by using 'new'. If your class is called 'GDL Interface', you would create an instance with something like
GDLInterface* interfacePalette = new GDLInterface;You also need to make sure the pointer is a global variable (initialised to 0), perhaps a static member variable of the GDLInterface class, and keep the constructor private so you get an instance with something like
GDLInterface* interfacePalette = GDLInterface::getInstance();Finally, make sure ArchiCAD knows your add-on has to remain loaded (see ACAPI_KeepInMemory) and the instance is deleted before the add-on shuts down.
Ralph Wessel BArch
Active Thread Ltd
Active Thread Ltd
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-11-28 02:53 AM
‎2007-11-28
02:53 AM
Yes!!!
Ralph Wessel, you helped me a lot. I've try pointers and memory allocation by new, but ArchiCAD crashed. Function ACAPI_KeepInMemory solved the problem.
Thanks again.
Maciek
Ralph Wessel, you helped me a lot. I've try pointers and memory allocation by new, but ArchiCAD crashed. Function ACAPI_KeepInMemory solved the problem.
Thanks again.
Maciek