12-12-2008 09:33 AM
i am searching for a way to post an event onto the event queue.
i found the QueueUserEvent() function but seems to only works in conjunction with GetUserEvent(). i don't want another queue, i want to post the event into the same queue than all the user interface. is there any way of achieving this ?
or maybe someone knows a way to trigger the EVENT_COMMIT or EVENT_VAL_CHANGED of a string control after programmatically changing the value of the control ?
Solved! Go to Solution.
12-12-2008 09:42 AM - edited 12-12-2008 09:43 AM
You could use CallCtrlCallback () immediately after programmatic change of control value. If the immediate calling of this function within the same routine that updates the control is not correct, you could define a special function for update to call with PostDeferredCall (), which is executed after the calling function terminates.
(Well, really you could simply call the control callback passing the appropriate values: it's a little rude but not forbidden. CallCtrlCallback preserves the callback chaining of the control, in case you have used it)
12-12-2008 10:41 AM
indeed, CallCtrlCallback() works. i was not aware of this function. (i also discovered callback chaining, i should see if it would not help solve my problem too...)
i am not fond of directly calling the callback. i'd rather post a new message, this let terminate the current iteration of the message loop and process any pending message before processing the posted message. also, calling callback functions directly can lead to a serious deadlock when 2 controls wants to update each other, while posting messages would allow the software to continue its normal execution flow. i think such a call is missing in the User Interface Library...
thanks anyway for the answer.