Browse by Tags

Browse by Tags
  • Blog Post: Modality, part 8: A timed MessageBox, the better version

    A few days ago, we saw a simple version of a timed message box which had a limitation that it could be used from only one thread at a time . Today we'll work to remove that limitation. As you may recall, the reason why it could be used from only one thread at a time was that we kept the "Did the...
  • Blog Post: Modality, part 7: A timed MessageBox, the cheap version

    As we noted at the end of part 3 , now that you know the conventions surrounding the WM_QUIT message you can put them to your advantage. The more robust you want the TimedMessageBox function to be, the more work you need to do. Here's the cheap version, based on the sample in the Knowledge...
  • Blog Post: Modality, part 6: Interacting with a program that has gone modal

    Earlier we saw the importance of setting the right owner window for modal UI . It is also important, when manipulating a window, to respect its modality. For example, consider the program we ended up with last time, the one which calls the MessageBox function to display a modal dialog. If we wanted to...
  • Blog Post: Modality, part 5: Setting the correct owner for modal UI

    Here is the very simple fix for the buggy program we presented last time . void OnChar(HWND hwnd, TCHAR ch, int cRepeat) { switch (ch) { case ' ': MessageBox( hwnd , TEXT("Message"), TEXT("Title"), MB_OK); if (!IsWindow(hwnd)) MessageBeep(-1); break; } } We have fixed the problem by passing...
  • Blog Post: Modality, part 4: The importance of setting the correct owner for modal UI

    If you decide to display some modal UI, it is important that you set the correct owner for that UI. If you fail to heed this rule, you will find yourself chasing some very strange bugs. Let's return to our scratch program and intentionally introduce a bug related to incorrect owner windows, so...
  • Blog Post: Modality, part 3: The WM_QUIT message

    After our two quick introductions to modality , we're now going to dig in a little deeper. The trick with modality is that when you call a modal function, the responsibility of message dispatch is handled by that function rather than by your main program. Consequently, if you have customized...
  • Blog Post: Modality, part 2: Code-modality vs UI-modality

    Last time, we saw an example of code that was UI-modal but not code-modal . The opposite is also true: You can have code-modality without UI-modality. In fact, this is far more common than the UI-modal-but-not-code-modal scenario. You encounter modal loops without a visible change in UI state when...
  • Blog Post: Modality, part 1: UI-modality vs code-modality

    From the end-users' point of view, modality occurs when the users are locked into completing a task once it is begun, with the only escape being to cancel the entire operation. Opening a file is an example of a modal operation: Once the "Open" command has been selected, users have no choice but to select...
Page 1 of 1 (8 items)