No announcement yet.

2x %bn_clicked in DDT callback(!)

  • Filter
  • Time
  • Show
Clear All
new posts

  • 2x %bn_clicked in DDT callback(!)

    When i switch from option1 to option2 using arrows, i get 2x a wm_command and bn_clicked.

    When i click a button with a msgbox call, after the msgbox option1 get's the focus.
    (usual for windows)
    But this also results in a option-click (while it's not beeing selected)

    This is a part of my callback;

    CallBack Function My_CallBack()

    Select Case cbmsg
    Case %WM_COMMAND

    If cbctlmsg = %BN_CLICKED Then

    Select Case CBCTL
    Case %ID_Option1
    Case %ID_Option2
    End Select

    End If

    End Select

    End Function

  • #2
    If I'm not mistaken, option buttons report "clicked" whenever they are turned on or off. If you select an option button, the button that you selected and the one that was previously selected will both report "clicked". You'll need to query the button states using CONTROL GET CHECK.

    -- Eric

    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    "Not my circus, not my monkeys."


    • #3
      Didn't notice that the msg where 2 different controls.

      I used the 'check'..




      • #4
        Edwin --
        it's possible to solve this problem by very easy way
           #Compile Exe
           #Register None
           #Dim All
           #Include "WIN32API.INC"
           CallBack Function DlgProc
              Static ii As Long, i As Long, j As Long
              Select Case CbMsg
                 Case %WM_COMMAND
                    If CbCtl >= 101 And CbCtl <= 103 Then
                       For i = 101 To 103
                          If i <> ii Then Control Get Check CbHndl, i To j: _
                             If j Then ii = i: ListBox Add CbHndl, 100, Time$ + Str$(i)
                    End If
              End Select
           End Function
           Function PbMain
              Local hDlg As Long
              Dialog New 0,"Option Group Test",,, 300,200, %WS_SYSMENU To hDlg
              Control Add ListBox,hDlg, 100,, 60, 10, 200, 140, %WS_VSCROLL, %WS_EX_CLIENTEDGE
              Control Add Option,hDlg,101, "Opt 1", 10, 15, 50, 14, %WS_GROUP Or %WS_TABSTOP
              Control Add Option,hDlg,102, "Opt 2", 10, 30, 50, 14
              Control Add Option,hDlg,103, "Opt 3", 10, 45, 50, 14
              Control Set Focus hDlg, 101
              Dialog Show Modal hDlg Call DlgProc
           End Function
        [This message has been edited by Semen Matusovski (edited May 10, 2000).]


        • #5
          Thanks Semen.

          As i said, i make use of the Get check DDT command.


          BTW, excellent shortcut code (shortened from JA)