* R6_PSA_Objects.PRG * November (c) 2006 Terry Thurber * All Rights Reserved close all clear all set exact on public myform as form myform=createobject('frmSPlitter') myform.show ******************************************************************** * START SPLITTER FORM DEMO * ******************************************************************** define class frmSplitter as form &&================================= nPercentLeft=0 nPercentTop=0 lMoveInProgress=.f. add object edtNE as edtBox with backcolor=15790335 add object edtNW as edtBox with backcolor=16056304 add object edtSE as edtBox with backcolor=15532031 add object edtSW as edtBox with backcolor=16773874 add object cmdX as cmdXClass with nActivePointer = 9 add object cmdY as cmdYClass with nActivePointer = 7 add object cmdXY as cmdXYClass with nActivePointer = 5 minheight=10 caption=[XY Quadrant Form Splitter] visible =.t. procedure init with this .edtNE.zorder(1) .edtNW.zorder(1) .edtSE.zorder(1) .edtSW.zorder(1) .cmdX.zorder(0) .cmdY.zorder(0) .cmdXY.zorder(0) store .50 to .nPercentLeft, .nPercentTop .resize endwith endproc procedure release this.queryunload endproc procedure queryunload clear events release all endproc procedure resize with this PSA_MoveSplitter(this,.nPercentLeft*.width,.nPercentTop*.height) .cmdX.height=.height-4 .cmdY.width=.width-4 endwith endproc enddefine && frmSplitter as Form &&================================= define class edtBox as editbox &&=================================== visible=.t. left=2 top=2 enddefine && edtBox as EditBox &&=================================== ******************************************************************** * END DEMO FORM CLASS * ******************************************************************** ******************************************************************** * START SCREEN SPLITTER * ******************************************************************** procedure PSA_MoveSplitter(oform,lnSplitterLeft,lnSplitterTop) &&--- with oform store m.lnSplitterLeft to .cmdX.left, .cmdXY.left store m.lnSplitterLeft+2 to .edtNW.left, .edtSW.left store m.lnSplitterLeft-2 to .edtNE.width, .edtSE.width store .width-m.lnSplitterLeft-3 to .edtNW.width, .edtSW.width store m.lnSplitterTop to .cmdY.top, .cmdXY.top store m.lnSplitterTop+2 to .edtSE.top, .edtSW.top store m.lnSplitterTop-2 to .edtNE.height, .edtNW.height store .height-m.lnSplitterTop-3 to .edtSE.height, .edtSW.height endwith endproc &&PSA_MoveSplitter(oform,lnSplitterLeft,lnSplitterTop) &&--- define class cmdSplitterClass as commandbutton &&=================== top=2 left=2 width=3 height=3 caption=[] style=1 visible=.t. nActivePointer = 0 && override for each subclass! function change_mousepointer(nXCoord, nYCoord) && interface only, define in Subclass with nActivePointer! procedure set_mousepointer (nXCoord, nYCoord) this.mousepointer=iif( this.change_mousepointer(m.nXCoord, m.nYCoord), this.nActivePointer, 0) function InWidth(nXCoord) return between(m.nXCoord-this.left, -1, +2) function InHeight(nYCoord) return between(m.nYCoord-this.top, -1 , +2) procedure mousemove (nButton, nShift, nXCoord, nYCoord) if thisform.lMoveInProgress local nSplitterLeft, nSplitterTop if [Y]$this.name nSplitterTop= max(min(m.nYCoord, thisform.height-4), 4) nSplitterLeft=thisform.cmdXY.left endif if [X]$this.name nSplitterLeft= max(min(m.nXCoord, thisform.width-4), 4) nSplitterTop=iif([XY]$this.name, m.nSplitterTop, thisform.cmdXY.top) endif PSA_MoveSplitter(thisform,m.nSplitterLeft,m.nSplitterTop) else = this.set_mousepointer (m.nXCoord, m.nYCoord) endif &&thisform.lMoveInProgress endproc procedure mousedown (nButton, nShift, nXCoord, nYCoord) thisform.lMoveInProgress=.t. = this.set_mousepointer (m.nXCoord, m.nYCoord) endproc &&MouseDown (nButton, nShift, nXCoord, nYCoord) procedure mouseup (nButton, nShift, nXCoord, nYCoord) this.mousepointer=0 thisform.nPercentLeft=thisform.cmdXY.left/thisform.width thisform.nPercentTop=thisform.cmdXY.top/thisform.height thisform.lMoveInProgress=.f. endproc enddefine && cmdSplitterClass as CommandButton &&=================== define class cmdXClass as cmdSplitterClass && ====================== function change_mousepointer (nXCoord, nYCoord) return this.InWidth(m.nXCoord) enddefine && cmdXClass as cmdSplitterClass && ====================== define class cmdYClass as cmdSplitterClass && ====================== function change_mousepointer (nXCoord, nYCoord) return this.InHeight(m.nYCoord) enddefine && cmdYClass as cmdSplitterClass && ====================== define class cmdXYClass as cmdSplitterClass && ===================== function change_mousepointer (nXCoord, nYCoord) return this.InWidth(m.nXCoord) and this.InHeight(m.nYCoord) enddefine && cmdYClass as cmdSplitterClass && ====================== ******************************************************************** * END SCREEN SPLITTER * ********************************************************************