Author | Topic: How to figure out xbpCellGroup when handle gestures | |
---|---|---|
Jack Duijf | How to figure out xbpCellGroup when handle gestures on Sun, 26 Aug 2018 14:43:08 +0200 Hello, CLASS My_XbpBrowse FROM xbpBrowse ... METHOD My_XbpBrowse:Gesture(nId,aInfo) ... Return If i start a gesture in a browse how can i find the actual cellgroup (xbpCellGroup) in the browse on the gesture position ? The callstack when the Gesture method is called looks like: 0I)My_XbpBrowse:Gesture 81 1I)XBPBROWSE:HANDLEEVENT 2003 2:FORWARDGESTURE 1653 3B)(I)XBPCOLUMN:CREATE 471 Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
Jose Antonio Diego Kereje | Re: How to figure out xbpCellGroup when handle gestures on Mon, 27 Aug 2018 09:33:47 +0200 Hello Jack, > CLASS My_XbpBrowse FROM xbpBrowse > ... > METHOD My_XbpBrowse:Gesture(nId,aInfo) > ... > Return The XbpBrowse class has already defined its own gesture method, so if you redefine it you will cancel its standard behavior (you have to keep in mind that if you "drag" on the data area of the columns, the browse scrolls the data). That is a part of the difficulty of enabling drag of a browse's data (there are a few more). And here you have two options: 1. Eliminate that standard behavior to enable the drag of the data. 2. Enable that if we start a drag operation in a selected cell, we want to drag with its content. But if we start it in an unselected cell, we activate the standard behavior of XbpBrowse (scroll). The second option is the one that I enabled a while ago. > If i start a gesture in a browse how can i find the actual cellgroup > (xbpCellGroup) in the browse on the gesture position ? One starting point may be the dataarea of each column (:lbDown() and :gesture() methods of XbpCellGroup()) INLINE METHOD LbDown( aPos ) **************************** ::aPosClick:= ::getcursorPos() ::nRow := ::cellFromPos( aPos ) IF ! ::drag( aPos ) ; ::XbpCellGroup:lbDown( aPos ) ; ENDIF RETURN self INLINE METHOD gesture( nId, aInfo ) *********************************** ... ELSEIF BAnd( aInfo[ XBP_GESTUREINFO_STATE ], XBP_GESTURESTATE_BEGIN ) == XBP_GESTURESTATE_BEGIN ::nRow:= ::cellFromPos( { 1, AppDeskTop():currentSize()[ 2 ] - aInfo[ XBP_GESTUREINFO_STARTPOS, 2 ] - GetPosAbsoluta( self )[ 2 ] } ) IF ::nRow # ::oBrowse:rowPos ; ::oBrowse:handleEvent( xbeP_Gesture, nId, aInfo ) ; ENDIF ELSEIF BAnd( aInfo[XBP_GESTUREINFO_STATE], XBP_GESTURESTATE_END ) == XBP_GESTURESTATE_END IF ::oDrag # nil ; ::oDrag:destroy() ; ::oDrag:= nil ; ENDIF IF ::nRow # ::oBrowse:rowPos ; ::oBrowse:handleEvent( xbeP_Gesture, nId, aInfo ) ; ENDIF ENDIF RETURN self Now I do not have time for more. Regards. Diego | |
Jack Duijf | Re: How to figure out xbpCellGroup when handle gestures on Mon, 27 Aug 2018 13:44:25 +0200 Hello Diego, Can youy please send me your contact details. (skype / email address) to jack@jdsoftware.nl I like to discuss this in private if possible. Regards, Jack Duijf >Hello Jack, > >> CLASS My_XbpBrowse FROM xbpBrowse >> ... >> METHOD My_XbpBrowse:Gesture(nId,aInfo) >> ... >> Return > >The XbpBrowse class has already defined its own gesture method, so if you >redefine it you will cancel its standard behavior (you have to keep in mind >that if you "drag" on the data area of ??the columns, the browse scrolls the >data). That is a part of the difficulty of enabling drag of a browse's data >(there are a few more). > >And here you have two options: > >1. Eliminate that standard behavior to enable the drag of the data. >2. Enable that if we start a drag operation in a selected cell, we want to >drag with its content. But if we start it in an unselected cell, we activate >the standard behavior of XbpBrowse (scroll). > >The second option is the one that I enabled a while ago. > >> If i start a gesture in a browse how can i find the actual cellgroup >> (xbpCellGroup) in the browse on the gesture position ? > >One starting point may be the dataarea of ??each column (:lbDown() and >:gesture() methods of XbpCellGroup()) > >INLINE METHOD LbDown( aPos ) >**************************** > ::aPosClick:= ::getcursorPos() > ::nRow := ::cellFromPos( aPos ) > > IF ! ::drag( aPos ) ; ::XbpCellGroup:lbDown( aPos ) ; ENDIF >RETURN self > >INLINE METHOD gesture( nId, aInfo ) >*********************************** >... > >ELSEIF BAnd( aInfo[ XBP_GESTUREINFO_STATE ], XBP_GESTURESTATE_BEGIN ) == >XBP_GESTURESTATE_BEGIN > ::nRow:= ::cellFromPos( { 1, AppDeskTop():currentSize()[ 2 ] - aInfo[ >XBP_GESTUREINFO_STARTPOS, 2 ] - GetPosAbsoluta( self )[ 2 ] } ) > IF ::nRow # ::oBrowse:rowPos ; ::oBrowse:handleEvent( xbeP_Gesture, nId, >aInfo ) ; ENDIF >ELSEIF BAnd( aInfo[XBP_GESTUREINFO_STATE], XBP_GESTURESTATE_END ) == >XBP_GESTURESTATE_END > IF ::oDrag # nil ; ::oDrag:destroy() ; ::oDrag:= nil ; ENDIF > IF ::nRow # ::oBrowse:rowPos ; ::oBrowse:handleEvent( xbeP_Gesture, nId, >aInfo ) ; ENDIF >ENDIF >RETURN self > >Now I do not have time for more. > >Regards. Diego | |
Jose Antonio Diego Kereje | Re: How to figure out xbpCellGroup when handle gestures on Tue, 28 Aug 2018 00:10:31 +0200 | |
Jack Duijf | Re: How to figure out xbpCellGroup when handle gestures on Tue, 28 Aug 2018 00:32:40 +0200 Hello Diego, Thank you for the new sample. Yes, that looks like what i am looking for. Are you willing to share the sourcecode for DragDrop.dll ? (DragColumn class) I think i can adapt this for drag-drop in the same browse. Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
Jose Antonio Diego Kereje | Re: How to figure out xbpCellGroup when handle gestures on Wed, 29 Aug 2018 01:23:42 +0200 Hello Jack, > I think i can adapt this for drag-drop in the same browse. In this case we add the difficulty that the :gesture() method is executed in the GUI-Thread and does not have access to the dbf. Regards. Diego DragDrop.zip | |
Jack Duijf | Re: How to figure out xbpCellGroup when handle gestures on Wed, 29 Aug 2018 09:31:31 +0200 Hello Diego, Thank you for the sample. This is exactly what i need. I start merging the sample code into my existing browse. I keep you informed about the results. Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
Jack Duijf | Re: How to figure out xbpCellGroup when handle gestures on Wed, 29 Aug 2018 10:16:29 +0200 Hello Diego, In the sample, i am missing the sourcecode of DragDataArea() class. Are you willing to share this? Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
Jose Antonio Diego Kereje | Re: How to figure out xbpCellGroup when handle gestures on Wed, 29 Aug 2018 23:15:10 +0200 I have always done it Regards. Diego | |
Jack Duijf | Re: How to figure out xbpCellGroup when handle gestures on Thu, 30 Aug 2018 00:53:48 +0200 Hello Diego, Thank you verry much. I did get the code in my mailbox. I can now add the code to my subclasses of xbpBrowse en xbpColumn. Thanks again Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
M.B. Baiju | Re: How to figure out xbpCellGroup when handle gestures on Fri, 31 Aug 2018 11:08:56 +0200 Jose Antonio Diego Kereje wrote in message news:261df31f$17b53ad5$215cf@news.alaska-software.com... >I have always done it > >Regards. Diego Hello Diego, Can you share the code me to DragDataArea() class. (baijumb@gmail.com) Regards, M.B.BAIJU | |
Jack Duijf | Re: How to figure out xbpCellGroup when handle gestures on Wed, 07 Nov 2018 18:38:26 +0100 Hello All, Finaly, I figured it out with the help of Alaska Support. In the end, it was quite simple, without external DLL functions. The trick is the usage of XbpFromPoint() and AppDesktop():MapPoint() The gestures are passed to the eventhandler. User defined events are: xbeU_STARTDRAG and xbeU_DROP CLASS GestureXbpColumn FROM XbpColumn HIDDEN: VAR lIsDragDrop EXPORTED: METHOD Init METHOD Create METHOD MyGesture METHOD GestureHandleEvent ENDCLASS METHOD GestureXbpColumn:Init( oParent, oGetList, lTest ) ::lIsDragDrop := FALSE ::XbpColumn:Init( oParent, oGetList, lTest ) Return SELF METHOD GestureXbpColumn:Create( oParent, oOwner, aPos, aSize, aPresParam, lVisible ) ::XbpColumn:Create( oParent, oOwner, aPos, aSize, aPresParam, lVisible ) ::DataArea:Gesture := {|nId,aInfo|::MyGesture(nId,aInfo)} Return METHOD GestureXbpColumn:MyGesture(nId,aInfo) LOCAL oXbp := XbpFromPoint(aInfo[XBP_GESTUREINFO_POS]) LOCAL aPos := AppDesktop():MapPoint(oXbp ,aInfo[XBP_GESTUREINFO_POS]) If nId # XBP_GESTURE_PAN ::GestureHandleEvent(nId,aInfo) Else nId = 4 --> XBP_GESTURE_PAN Do Case Case BAnd( aInfo[ XBP_GESTUREINFO_STATE ], XBP_GESTURESTATE_BEGIN ) == XBP_GESTURESTATE_BEGIN PostAppEvent(xbeM_LbClick,aPos,,oXbp) Start drag only when position changes ::lIsDragDrop := FALSE Case aInfo[ XBP_GESTUREINFO_STATE ] = 0 We are dragging If !::lIsDragDrop First indication we are starting the drag-drop by gestures IF ( Abs( aInfo[ XBP_GESTUREINFO_POS, 1 ] - aInfo[ XBP_GESTUREINFO_STARTPOS, 1 ] ) > 3 .OR. ; Abs( aInfo[ XBP_GESTUREINFO_POS, 2 ] - aInfo[ XBP_GESTUREINFO_STARTPOS, 2 ] ) > 3 ) PostAppEvent(xbeU_STARTDRAG,aPos,,oXbp) ::lIsDragDrop := TRUE Endif Else Just moving arroud... PostAppEvent(xbeM_Motion,aPos,,oXbp) Endif Case BAnd( aInfo[XBP_GESTUREINFO_STATE], XBP_GESTURESTATE_END ) == XBP_GESTURESTATE_END If ::lIsDragDrop Handle Drop PostAppEvent(xbeU_DROP,aPos,,oXbp) ::lIsDragDrop := FALSE Endif Endcase Endif Return METHOD DC_GestureXbpColumn:GestureHandleEvent(nId,aInfo) ::handleEvent( xbeP_Gesture, nId, aInfo ) ::lIsDragDrop := FALSE Return Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) |