On 4/18/18, Ranier VF <ranier_...@hotmail.com> wrote: > Hi, > Obviously I'm not saying to Call PostMessage Windows function, > in other platforms. > So I understood, only have problem is Windows Loop Event (IUP), > and the autor what do you cite, say clearly that PostThreadMessage > is wrong way to solve this (update GUI in another thread). > > Best, > Ranier Vilela
As I tried to explain in my proposal, saying it is "the wrong way" is more nuanced than that. (That's why he wrote the blog article in the first place.) For *most* people, it is "the wrong way" because there is a much simpler way, PostMessage. But as I tried to point out, PostMessage is "wrong for us" because it artificially couples the posting of a message with a window handle. None of the other platforms couple their widgets with their event loop control. Only Windows does that, which creates an impedance mismatch for all the other platforms. (Apple is a strong counter-example to the Windows design. Apple has a strong division between their GUI framework (AppKit) and their non-GUI framework (Foundation). You can write command line and server daemons in Foundation without ever touching AppKit. All the event loop stuff is in Foundation, not AppKit. AppKit however builds on top of Foundation and leverages the event loops.) Furthermore, in ALmixer example, I operate on the button widget, not a window widget. Using PostMessage is wrong from an API standpoint because now this weird implementation detail restriction that says you must only operate on things that happen to be windows on MS-Windows platforms. If we allow that implementation detail to creep into the public API of IupPostMessage(), I have no doubt it will become a gotcha for a lot of people and we'll get a ton of never-ending support questions of "Why does this work in GTK, but on Windows, nothing is happening?. Additionally, if we allow that implementation detail to creep into the public API, the question then becomes, what does that mean for the other platforms? (The first question I "ask" in my IUP for iOS & Android video, is "What does Dialog mean for iOS & Android?" because they don't use "windows" like desktops.) PostThreadMessage() is the more general API that allows us to post messages, without the explicit window coupling. And with Raymond Chen's solution, we don't have to sacrifice anything for using it. So for IUP, I believe this is the "right" solution. Thanks, Eric ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users