Announcement

Collapse
No announcement yet.

Is this safe to do?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scott Turchin
    replied
    The downfall is having the variable ChangesSaved or whatnot, and for each object on the GUI you have to set that flag if an event happens on it, which is not really TOO big of a deal but by doing it you get the feature you want
    so here for example is a checkbox to set some option or another...
    I set the flag, re-enable the Apply button etc...
    Now, cool thing is that sometimes users press OK without pressing Apply, easily fixed by that flag, if istrue ChangesNotSaved then sendmessage GetDlgITem(oDlg,%idapply),%BM_CLICK,0,0 and walah you just pressed the apply button for them, and all of your code can be called in teh apply code and not duplicated....

    It works for me, everyone has a different style but it works
    Code:
                 Case %IDOK
                    SendMessage GetDlgItem(oDlg,%IDAPPLY) , %BM_CLICK, 0, 0
    
    
                 Case %IDCHECK2
                      ChangesNotSaved = %TRUE
                      Control Enable oDlg, %IDAPPLY
                      Function = 1
                      Exit Function

    Scott


    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet

    Leave a comment:


  • mark smit
    Guest replied
    Scott,

    You are completely correct! That's exactly what I want to do. I was unsure as to what extent the "dialog end" function worked. Thank you for clearing that up for me!


    ------------------
    Cheers

    Leave a comment:


  • Scott Turchin
    replied
    If I understand what you are doing, NO you can't do that...

    If the window is closing you want to read all of the data etc and then do say, registry chagnes, change values etc? (Like an options dialog box???)...

    I create an apply button and a static variable to see if changes were made.
    If changes were made and WM_DESTROY comes down, then send a message to apply to process.


    Code:
        Case %WM_CLOSE
             If IsTrue ChangesNotSaved Then
                Result = MsgBox("Save changes?",%MB_ICONQUESTION Or %MB_YESNO,Mine)
                If Result = %IDYES Then
                    SendMessage GetDlgItem(oDlg,%IDAPPLY) , %BM_CLICK, 0, 0
                End If
             End If

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet

    Leave a comment:


  • mark smit
    Guest started a topic Is this safe to do?

    Is this safe to do?

    Hello,

    Can you safely access editbox controls when processing the WM_DESTROY message. My program calls "dialog end cbhndl" when the cancel button is pressed. I then process the WM_DESTROY message, reading all the editboxes and saving the strings to the registry. Should I be doing this before I call "dialog end cbhndl" ?


    -------------
    Cheers
Working...
X