Closing NOT Modeless Dialog box

Product Compare Forums General General Chat Closing NOT Modeless Dialog box

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #798
    Anonymous
    Participant

    Hi,
    I have a “big” problem. How can I get my dialog box to close when I press f.ex. ‘a’?

    The dialog is created as “not-modeless”:

    int myc = DlgExecute( myDlg, 2001, “A”, “”, “/HOOK=MyDlgProc”,0);

    Any help?

    :idea:

    #3643
    Anonymous
    Participant

    Sorry to take so long to reply to this; I don’t often browse through General Chat. Next time around, post this sort of question in Support and it’ll get noticed more quickly.

    You’re not quite thinking in Windows terms; you don’t specify an exit character as a parameter to DlgExecute() (although you could, by passing it as an argument to your WndProc function).

    Bear in mind that Multi-Edit’s Windows-related functions, including the dialog box functions in Dialog.s are a wrapper over a subset of the similar functions in the Windows API, with some minor changes, and that they’ll largely behave exactly the way their Microsoft counterparts do (at some level, they invoke those counterparts, so this should come as no surprise).

    With that in mind, have a look at the DlgExecute() macro in Dialog.s. In particular, read its comments carefully, paying especial attention to the /LOOPMAC= parameter. You were on the right track with the /HOOK= parameter, but it’s a bit general for your purpose, and /LOOPMAC= is expected by DlgExecute() to return any of several values in Return_Int, one of which, 2, will exit the dialog. You just have to supply a macro that fits the definition, and that can intercept the keystroke you want. Just make sure that if the keystroke isn’t one you want to act on within the /LOOPMAC= macro, you leave it on the Windows message queue.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.