16 July 2020, 12:34 | #1 |
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 962
|
Raise event from STRING_KIND gadget without loosing focus?
I have added a hook on a STRING_KIND gadget. The hook code is as follows:
Code:
if(strcmp(obj->WorkBuffer, "Hello") == 0) { obj->Code = 'F'; obj->Actions |= SGA_END; return (~0); } else { return 0; } Code:
while(run) { ... case GAD_ANSWER_TXT: if(msg->Code == 'F') { printf("Correct Answer Given!\n"); } ... Code:
ActivateGadget(my_answer_field, my_window, NULL); Therefore I was wondering, is there a way how I can raise an IDCMP event / message from a STRING_KIND gadget without loosing focus from same STRING_KIND gadget? |
16 July 2020, 14:51 | #2 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Quote:
If you want some other form of feedback for your application, SGA_END is not what you are looking for. Instead, you could allocate a signal in your main task, and run into a Signal() in the string gadget hook, indicating for your main task that somethig is to be done about the string gadget. |
|
16 July 2020, 18:51 | #3 | |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
Quote:
1. track which gadget is the current gadget 2. enable IDCMP_RAWKEY events 3. handle the IDCMP_RAWKEY and update/check the gadget as you like |
|
16 July 2020, 20:25 | #4 | |
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 962
|
Hi Thomas,
I followed this example on signals and looks to be working: https://wiki.amigaos.net/wiki/Exec_S...ating_a_Signal Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Use two or more colours in STRING_KIND gadget at the same time. | Sim085 | Coders. C/C++ | 1 | 02 July 2020 06:21 |
Event hacking and window focus | hth313 | Coders. System | 0 | 19 June 2019 18:34 |
Intuition Requester: programmatically set focus on string gadget? | Warty | Coders. C/C++ | 3 | 08 September 2018 07:35 |
Gadget/Layout.gadget V44 | ruliovega | support.Apps | 6 | 02 January 2006 11:50 |
Loosing fullscreen focus when moving mouse. | spiff | support.WinUAE | 1 | 15 October 2004 13:52 |
|
|