Announcement

Collapse
No announcement yet.

Dumb question

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

  • Dumb question

    Yes it is, but maybe someone new here hasn't seen this posted and wants to know too

    I know the answer is right in front of my face, I've already encountered this but it's been so long.


    hDlg calls this function, when the dialog box pops up you can hit ESCAPE and it goes away.

    I don't want that.


    By removing %IDCANCEL the problem goes away but I want a cancel button, I just want hte user to have to CLICK it.


    Code:
    '-----------------------------------------------------------------------------------------
    Function CreateLicenseFile(hWnd As Long) As Long
    Local lResult   As Long
    Local lDlg      As Long
    'dialog new etc
    Dialog New hWnd,"Create a License agreement or note to user",,, 375,250,%WS_CAPTION Or %WS_SYSMENU Or %WS_THICKFRAME To lDlg
    
    Control Add TextBox, lDlg, %IDLIC_TEXT1 ,"",5,30,365,190,%WS_TABSTOP Or %ES_WANTRETURN Or %ES_MULTILINE Or %WS_VSCROLL,%WS_EX_CLIENTEDGE
    Control Add Label, lDlg, %IDLICLABEL1, "Enter license agreement text or a note to user then click Save" ,5,10, 250,20
    Control Add Button, lDlg, %IDLIC_SAVE, "&Apply",250,230,45,14,%BS_DEFAULT
    Control Add Button, lDlg, %IDCANCEL, "&Cancel",300,230,60,14
    Dialog Send lDlg, %WM_SETICON, %ICON_BIG, hIcon
    Dialog Show Modal lDlg Call LicenseCreatorProc To lResult
    Function = lResult
    End Function
    '-----------------------------------------------------------------------------------------
    CallBack Function LicenseCreatorProc() As Long
    Local lResult   As Long
    
    Select Case CbMsg
        Case %WM_INITDIALOG
        Case %WM_COMMAND
            Select Case LoWrd(CbWparam)
                   Case %IDLIC_SAVE
                        Control Get Text CbHndl,%IDLIC_TEXT1 To g_LicenseText
                        Dialog End CbHndl,%TRUE
                   Case %IDCANCEL
                     If CbCtlMsg = %BN_CLICKED Then Dialog End CbHndl,%FALSE
            End Select
    End Select
    End Function
    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    Ah, see just by posting it I remembered the answer:

    Don't use %IDCANCEL!

    %IDLIC_CANCEL = %WM_USER + 2401

    REPLACE %IDCANCEL with %IDLIC_CANCEL and problem goes away


    Scott

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment

    Working...
    X