Author | Topic: Re: XbpPushButton() | |
---|---|---|
Jim Lee | Re: XbpPushButton() on Wed, 20 Jun 2018 04:54:52 +0200 it is a very old Thread ... neverless it is easy this Way DO WHILE !lExit = .T. nEvent := AppEvent(@mp1, @mp2, @oXbp ) DO CASE CASE nEvent == xbeP_Keyboard .and.; mp1 == xbeK_ENTER .and.; ,NOT. EMPTY(oXbp) .and.; oXbp:isDerivedFrom("XbpPushButton") send Event to activate Pushbutton PostAppEvent(xbeP_Activate,,,oXbp) OTHERWISE oXbp:handleEvent(nEvent, mp1,mp2) ENDCASE ENDDO now every Pushbutton can react on ENTER ... if it have Focus ! | |
Carlos a Beling | Re: XbpPushButton() on Wed, 20 Jun 2018 10:20:11 -0300 Hello Jim. Good morning Many thanks. The real problem is that the method :draw() is not executed. Please see the attach. I confirmed it using the debugger. Fraternaly Beling Em 19/06/2018 23:54, Jim Lee escreveu: > it is a very old Thread ... neverless it is easy this Way > > DO WHILE !lExit = .T. > nEvent := AppEvent(@mp1, @mp2, @oXbp ) > DO CASE > CASE nEvent == xbeP_Keyboard .and.; > mp1 == xbeK_ENTER .and.; > ,NOT. EMPTY(oXbp) .and.; > oXbp:isDerivedFrom("XbpPushButton") > > send Event to activate Pushbutton > PostAppEvent(xbeP_Activate,,,oXbp) > > OTHERWISE > oXbp:handleEvent(nEvent, mp1,mp2) > ENDCASE > ENDDO > > now every Pushbutton can react on ENTER ... if it have Focus ! > > NotExecuted.png | |
Jim Lee | Re: XbpPushButton() on Wed, 20 Jun 2018 16:15:21 +0200 > The real problem is that the method :draw() is not executed. this Thread was just to activate Button with ENTER i will answer in other Thread | |
Carlos A Beling | Re: XbpPushButton() on Tue, 09 Oct 2018 10:48:13 -0300 Hello Jim: good morning. I tried to activate a pushbutton with xbek_ENTER in the Diego's Class RoundPB as below and it worked fine: INLINE METHOD keyboard(nKey) if nKey == xbeK_SPACE .or.; nKey == xbeK_RETURN PostAppEvent(xbeP_Activate,,, Self) else ::XbpPushButton:handleEvent(nKey, NIL, NIL) endif RETURN Self It has a problem that xbek_Tab stoped to work. Do you know why? Fraternally Beling Em 19/06/2018 23:54, Jim Lee escreveu: > it is a very old Thread ... neverless it is easy this Way > > DO WHILE !lExit = .T. > nEvent := AppEvent(@mp1, @mp2, @oXbp ) > DO CASE > CASE nEvent == xbeP_Keyboard .and.; > mp1 == xbeK_ENTER .and.; > ,NOT. EMPTY(oXbp) .and.; > oXbp:isDerivedFrom("XbpPushButton") > > send Event to activate Pushbutton > PostAppEvent(xbeP_Activate,,,oXbp) > > OTHERWISE > oXbp:handleEvent(nEvent, mp1,mp2) > ENDCASE > ENDDO > > now every Pushbutton can react on ENTER ... if it have Focus ! > > | |
Jim Lee | Re: XbpPushButton() on Tue, 09 Oct 2018 20:46:18 +0200 hi, > I tried to activate a pushbutton with xbek_ENTER in the Diego's Class sorry have not Diego CLASS > It has a problem that xbek_Tab stoped to work. > Do you know why? o:tabstop ? | |
Carlos A Beling | Re: XbpPushButton() on Wed, 10 Oct 2018 10:22:55 -0300 Hello Jim: good morning. Many thanks. I posted the question to you based upon the example that you posted some time ago. Mr Diego had the kindness to answer the question. Fraternally Beling Em 09/10/2018 15:46, Jim Lee escreveu: > hi, > >> I tried to activate a pushbutton with xbek_ENTER in the Diego's Class > > sorry have not Diego CLASS > >> It has a problem that xbek_Tab stoped to work. >> Do you know why? > > o:tabstop ? > > > | |
Jose Antonio Diego Kereje | Re: XbpPushButton() on Tue, 09 Oct 2018 22:49:51 +0200 Hi Carlos, INLINE METHOD Keyboard( nKey ) ****************************** IF nKey == xbeK_SPACE .OR. nKey == xbeK_RETURN IF ::activate # nil ; PostAppEvent( xbeP_Activate,,, self ) ; ENDIF ELSE ::XbpPushButton:keyboard( nKey ) ENDIF RETURN self Regards. Diego | |
Jose Antonio Diego Kereje | Re: XbpPushButton() on Tue, 09 Oct 2018 23:02:59 +0200 Hello again, Visually the effect will be better if you do it that way: INLINE METHOD Keyboard( nKey ) ****************************** LOCAL nState IF nKey = xbeK_SPACE .OR. nKey == xbeK_RETURN IF ::activate # nil ; PostAppEvent( xbeP_Activate,,, self ) ; ENDIF nState:= ::controlState ::controlState:= XBP_STATE_PRESSED ::invalidateRect() Sleep( 20 ) ::controlState:= nState ::invalidateRect() ELSE ::XbpPushButton:keyboard( nKey ) ENDIF RETURN self Regards. Diego |