Alaska Software Inc. - Topdown - TdpshBtn don't react to left click
Username: Password:
AuthorTopic: Topdown - TdpshBtn don't react to left click
Philip JacksonTopdown - TdpshBtn don't react to left click
on Mon, 09 May 2011 18:10:15 +1200
I have the following event loop - I have a number of Push buttons with 
the bAct parameter containing a valid code block. I would have thought 
that oXbp:handleEvent() would have executed the action block but 
obviously not.

What do I need to do to know which button was pressed or get the action 
block working with a single mouse click.

******* Event Loop
nEvent := 0
DO WHILE nEvent <> xbeP_Close
    nEvent := AppEvent(@mp1,@mp2,@oXbp)
    IF nEvent = xbeM_LbDblClick
       nEvent := xbeP_Keyboard  emulate ENTER for edit row
       MP1    := xbeK_ENTER
    ENDIF
    IF nEvent = xbeP_Keyboard
        translate mp1 to ALT_ equivalents
       IF MP1 >= ASc("A") .and. MP1 <= Asc("z") .and. ;
         ascan(aButtonAccelKey, MP1) = 0
         IF MP1 >= Asc("a")
            MP1 := asc(upper(chr(MP1)))
         ENDIF
         mp1 += (xbeK_ALT_A - ASC("A"))
       ENDIF
       DO CASE
          CASE MP1 = xbeK_RIGHT
              loop  ignore this
          CASE (n := ascan(aButtonAccelKey, MP1)) > 0
               //aRef[nLenaRef + TD_DEFAULT] := oBrowse[1]:nCurEl
               nReturnVal := eval(aButtonBlocks[n], oBrowse)
               IF !nReturnVal==NIL .and. ValType(nReturnVal) = 'N' .and.;
                  nReturnVal == DCGUI_EXIT
                  exit
               ENDIF
               setAppFocus(oDlg)
               setAppFocus(oBrowse[1])
       OTHERWISE
               oXbp:handleEvent(nEvent,mp1,mp2)
       ENDCASE
    ELSE
       oXbp:handleEvent(nEvent,mp1,mp2)
    ENDIF
ENDDO

Cheers

Phil Jackson
Philip JacksonRe: Topdown - TdpshBtn don't react to left click
on Tue, 10 May 2011 12:11:48 +1200
Got it solved!

I just added some lines to test for left click, and that the object had 
an Activate method and it worked fine.