![]() |
![]() |
#1 |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
[Commodity] handling commodity window/interface
Hi,
I am not sure how to handle commodity window/interface. Commodity can have its window that can be show/hide In the Exchange app. Should I create and open new window When the Commodity is created and then just Show/hide it? Or the window should be created/closed Each time the user clicks show/hide in the Exchange app.? |
![]() |
![]() |
#2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
When the user chooses hide, you should close the window and ideally release all GUI-related resources.
The reason is that while the GUI is hidden, the user expects to be able to close the Workbench screen (for example for a screen mode change). This is not possible if you keep the window open and only hide it. Also the new functions HideWindow and ShowWindow are only available in OS 3.2+. So if you don't want to reach only half or less of the community, you should avoid these functions. While the GUI is hidden it should not consume any resources, so if possible you should close all external libraries, classes and so on. |
![]() |
![]() |
#3 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,062
|
What an outdated approach. You should always statically link all boost and cef libraries at a minimum, and don't forget denuvo (it's not for games only!1!11!). If they can't handle it, they should buy new hardware.
|
![]() |
![]() |
#4 | |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
Quote:
|
|
![]() |
![]() |
#5 |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
I forgot to ask one more question.
The commodity has its own main loop that process messages in it. If I want to create and show the window - its also need to have its own message loop? I am not sure how to combine that two loops? Maybe you have some examples in C? In my case - my commodity checks something each couple of seconds and stores the result. But optionally I would also update that result in the window. |
![]() |
![]() |
#6 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
You should build your program around one main loop with one Wait() instruction which waits for events from all parts of your app.
It could look like this: Code:
BOOL cont = TRUE; do { ULONG winsig = 1L << win->UserPort->mp_SigBit; ULONG timersig = 1L << timereq->tr_node.io_Message.mn_ReplyPort->mp_SigBit; ULONG cxsig = 1L << cxport->mp_SigBit; ULONG sigs_received = Wait (winsig | timersig | cxsig | SIGBREAKF_CTRL_C); if (sigs_received & SIGBREAKF_CTRL_C) { cont = FALSE; } if (sigs_received & timersig) { WaitIO (timereq); ... timereq->tr_node.io_Command = TR_ADDREQUEST; SendIO (timereq); } if (sigs_received & winsig) { struct IntuiMessage *imsg; while ((imsg = GetMsg (win->UserPort))) { switch (imsg->Class) { ... } ReplyMsg (imsg); } } if (sigs_received & cxsig) { CxMsg *cxmsg; while ((cxmsg = GetMsg (cxport))) { switch (CxMsgType (cxmsg)) { ... } ReplyMsg (cxmsg); } } } while (cont); You can safely set one of the signals to 0 if that part of your app is currently not active. For example if you change the code to Code:
ULONG winsig = (win != NULL ? 1L << win->UserPort->mp_SigBit : 0); Last edited by thomas; 02 May 2023 at 09:14. |
![]() |
![]() |
#7 | |
Registered User
Join Date: Jan 2020
Location: Poland
Posts: 181
|
Quote:
![]() |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commodity] Commodity that monitors status - code review request | mateusz_s | Coders. System | 6 | 29 April 2023 03:17 |
Can this application be a Commodity? | mateusz_s | Coders. System | 2 | 19 December 2021 01:54 |
Making a commodity - some questions | peceha | Coders. Blitz Basic | 14 | 11 March 2018 18:41 |
Helpful commodity | idrougge | Coders. Blitz Basic | 0 | 14 December 2015 19:51 |
Looking for Caps2Ctrl commodity | kolla | support.Apps | 7 | 24 October 2009 17:14 |
|
|