problem with moviong objects on the tabpage
Posted: Sat Jan 18, 2014 11:44 am
Hi Roger,
moving objects in single window works without problems (test1). But if some objects are on the tabpage and I click on the object I want to move, it first moves down the height of bookmarks, and then can be moved where I want to (test 2 and 3).
For a clearer demonstration I do attach a sample, it is mainly to see if the height tabs larger.
Click on Test PushButton in each dialog window for start moving...
moving objects in single window works without problems (test1). But if some objects are on the tabpage and I click on the object I want to move, it first moves down the height of bookmarks, and then can be moved where I want to (test 2 and 3).
For a clearer demonstration I do attach a sample, it is mainly to see if the height tabs larger.
Click on Test PushButton in each dialog window for start moving...
Code: Select all
#include "dcdialog.ch"
#include "appevent.ch"
#include 'dccursor.ch'
**************
Procedure Main()
**************
Private plDesignMode := .F.
Test1()
Test2() && +3
RETURN
*
**************
Function Test1()
**************
LOCAL GetList[0], cTest := 'test '
@ 1, 1 DCSAY 'Test:'
@ 1,10 DCGET cTest
@ 3, 1 DCPUSHBUTTON CAPTION 'Test A' SIZE 15,1 ACTION { || MsgBox('TestA') }
@ 3, 20 DCPUSHBUTTONXP CAPTION 'Test B' SIZE 15,1 ACTION { || MsgBox('TestB') } SHADOW 6 RADIUS 10
@ 10, 1 DCSAY 'abc'
@ 10,30 DCPUSHBUTTON CAPTION 'Design On' SIZE 15,1 ACTION { || M->plDesignMode := .T. } ;
TOOLTIP 'Press Ctrl+O for Design OFF'
DCREAD GUI FIT MODAL HANDLER TestHandler REFERENCE GetList ADDBUTTONS
RETURN
*
**************
Function Test2()
**************
Xtest(1) && this is from DOC, I just added Handler...
Xtest(2) && and here I changed height and width of tabs
RETURN
*
***************
PROCEDURE Xtest(_nVersion)
***************
LOCAL oTabPage1, oTabPage2, oTabPage3, cDesc := Space(30),;
aType := {'Star-Trek','Hollywood','Sports','Other'},;
cType := Space(15), dDateOrig := Date(), dDateAcqu := Date(),;
nOrigPrice := 0, nApprValue := 0, cMemo := '', ;
GetList := {}
/* ---- Tab Page #1 ---- */
If ( _nVersion == 1 )
@ 0,0 DCTABPAGE oTabPage1 CAPTION 'Collection' ;
SIZE 72,15 ;
PREOFFSET 0 POSTOFFSET 85
Else
@ 0,0 DCTABPAGE oTabPage1 CAPTION 'Collection' ;
SIZE 72,15 ;
TABHEIGHT 50 TABWIDTH 15 ANGLE 30
EndIf
@ 3,2 DCSAY "Description" GET cDesc SAYRIGHT PARENT oTabPage1
@ 5,10 DCSAY "Type" PARENT oTabPage1 SAYSIZE 8
@ 6,10 DCCOMBOBOX cType LIST aType SIZE 12,6 PARENT oTabPage1
/* ---- Tab Page #2 ---- */
@ 0,0 DCTABPAGE oTabPage2 CAPTION 'Financial' ;
RELATIVE oTabPage1
@ 4,2 DCSAY " Original Date" GET dDateOrig PICT '99/99/9999' ;
PARENT oTabPage2 SAYRIGHT
@ 6,2 DCSAY " Acquired Date" GET dDateAcqu PICT '99/99/9999' ;
PARENT oTabPage2 SAYRIGHT
@ 8,2 DCSAY " Acquired Price" GET nOrigPrice PICT '9999.99' ;
PARENT oTabPage2 SAYRIGHT
@ 10,2 DCSAY "Appraised Value" GET nApprValue PICT '9999.99' ;
PARENT oTabPage2 SAYRIGHT
/* ---- Tab Page #3 ---- */
@ 0,0 DCTABPAGE oTabPage3 CAPTION 'Memo' ;
RELATIVE oTabPage2
@ 5,2 DCMULTILINE cMemo PARENT oTabPage3 SIZE 65,8 ;
FONT "10.Courier.Bold"
@ 17,30 DCPUSHBUTTON CAPTION 'Design On' SIZE 15,1 ACTION { || M->plDesignMode := .T. } ;
TOOLTIP 'Press Ctrl+O for Design OFF' && Added by Zdeno
DCREAD GUI ;
TITLE 'Tab-Page Demo' ;
FIT ;
ADDBUTTONS ;
HANDLER TestHandler REFERENCE GetList && Added by Zdeno
RETURN
*
*******************************
/*Static*/ FUNCTION TestHandler( nEvent, mp1, mp2, oXbp, oDialog, GetList, aApp )
*******************************
Local nWidth, nHeight
Local aCoords := {}
STATIC nCursor := POINTER_ARROW_1, nDragMode := 0
If ( nEvent == xbeP_Keyboard )
If ( mp1 == xbeK_CTRL_O )
M->plDesignMode := .F.
nCursor := POINTER_ARROW_1
nDragMode := 0
DC_SetPointerTree( oDialog, nil, nCursor, 1 )
DC_GetRefresh( GetList )
RETURN DCGUI_IGNORE
EndIf
Else
If M->plDesignMode
If ( nEvent == xbeM_Motion )
nWidth := oXbp:CurrentSize()[1]
nHeight := oXbp:CurrentSize()[2]
IF oXbp == oDialog .OR. oXbp == oDialog:drawingArea .OR. Upper(oXbp:ClassName()) == 'XBPTABPAGE'
nCursor := POINTER_ARROW_1
ELSEIF mp1[1] >= nWidth - 5 .AND. mp1[2] >= nHeight - 5
nDragMode := DCGUI_DRAG_RIGHT_TOP
nCursor := POINTER_SIZE1_1
ELSEIF mp1[1] >= nWidth - 5 .AND. mp1[2] <= 5
nDragMode := DCGUI_DRAG_RIGHT_BOTTOM
nCursor := POINTER_SIZE2_1
ELSEIF mp1[1] <= 5 .AND. mp1[2] >= nHeight - 5
nDragMode := DCGUI_DRAG_LEFT_TOP
nCursor := POINTER_SIZE2_1
ELSEIF mp1[1] <= 5 .AND. mp1[2] <= 5
nDragMode := DCGUI_DRAG_LEFT_BOTTOM
nCursor := POINTER_SIZE1_1
ELSEIF mp1[1] <= 5
nDragMode := DCGUI_DRAG_LEFT
nCursor := POINTER_SIZE3_1
ELSEIF mp1[1] >= nWidth - 5
nDragMode := DCGUI_DRAG_RIGHT
nCursor := POINTER_SIZE3_1
ELSEIF mp1[2] <= 5
nDragMode := DCGUI_DRAG_BOTTOM
nCursor := POINTER_SIZE4_1
ELSEIF mp1[2] >= nHeight - 5
nDragMode := DCGUI_DRAG_TOP
nCursor := POINTER_SIZE4_1
ELSE
nDragMode := DCGUI_DRAG_ENTIRE_OBJECT
nCursor := POINTER_MOVE_1
ENDIF
IF IsMethod(oXbp,'SetPointer')
oXbp:SetPointer( nil, nCursor, 1 )
ENDIF
RETURN DCGUI_IGNORE
ELSEIF ( nEvent == xbeM_LbDown )
aCoords := DC_MoveObject( oXbp, mp1, nDragMode, nCursor, { .F. } )
RETURN DCGUI_IGNORE
EndIf
EndIf
EndIf
RETURN DCGUI_NONE
*
* EOF