Files
comun/clase/xresize.vc2

124 lines
4.0 KiB
Plaintext

*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="xresize.vcx" CPID="1254" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS xresize AS custom
*< CLASSDATA: Baseclass="custom" Timestamp="" Scale="Pixels" Uniqueid="" />
*<DefinedPropArrayMethod>
*m: addmember
*m: rearrange && Put it into form's resize event.
*p: auto && Auto decise which controls resize,move...
*p: fheight && form's init height
*p: fwidth && form's init width
*p: has && Internal use.
*p: limit && Resize and move limit for controls.
*a: cntlist[1,8] && Internal use
*</DefinedPropArrayMethod>
PROTECTED cntlist,fheight,fwidth,has
*<PropValue>
Height = 19
limit = 30
Name = "xresize"
Width = 22
*</PropValue>
PROTECTED PROCEDURE addmember
xytag=UPPER(xycont.tag)
IF this.auto AND EMPTY(xytag)
IF INLIST(xycont.baseclass,"Grid","Editbox",;
"Listbox","Image","Pageframe")
xytag="RESIZABLE"
ELSE
xytag="MOVABLE"
ENDIF
ENDIF
IF ! ("RESIZABLE"$m.xytag OR "MOVABLE"$m.xytag)
RETURN
ENDIF
this.has=.t.
this.fheight=thisform.Height
this.fwidth=thisform.Width
i=m.i+1
DIMENSION this.cntlist(m.i,12)
this.cntlist(m.i,1)=xycont
this.cntlist(m.i,2)=xycont.left
this.cntlist(m.i,3)=xycont.top
this.cntlist(m.i,4)=xycont.height
this.cntlist(m.i,5)=xycont.width
this.cntlist(m.i,6)="RESIZABLE"$m.xytag
this.cntlist(m.i,7)="NOVERTICAL_RESIZE"$m.xytag
this.cntlist(m.i,8)="NOHORIZONTAL_RESIZE"$m.xytag
this.cntlist(m.i,9)="MOVABLE"$m.xytag
this.cntlist(m.i,10)="NOVERTICAL_MOVE"$m.xytag
this.cntlist(m.i,11)="NOHORIZONTAL_MOVE"$m.xytag
this.cntlist(m.i,12)="VERTICAL_GROUP"$m.xytag
ENDPROC
PROCEDURE Init
*this class is free
*Author : Metin Emre
*e-mail : metinemre@hotmail.com
PRIVATE i,xycont,xytag,xycont2
i=0
FOR EACH cnt IN thisform.Controls
xycont=cnt
this.addmember
IF xycont.baseclass="Pageframe"
FOR EACH xycont2 IN cnt.pages
FOR EACH xycont IN xycont2.controls
this.addmember
NEXT
NEXT
ENDIF
NEXT
ENDPROC
PROCEDURE rearrange && Put it into form's resize event.
IF !this.has
RETURN
ENDIF
LOCAL alen,i,xycont,new
alen=ALEN(this.cntlist,1)
FOR i=1 TO m.alen
xycont=this.cntlist(m.i,1)
IF this.cntlist(m.i,6) &&--- resizable ---
new=thisform.height-(this.fheight - this.cntlist(m.i,4))
IF !this.cntlist(m.i,7) AND m.new>this.limit
xycont.height=m.new
ENDIF
new=thisform.width-(this.fwidth -this.cntlist(m.i,5))
IF !this.cntlist(m.i,8) AND m.new>this.limit
xycont.width=m.new
ENDIF
ENDIF
IF this.cntlist(m.i,9) &&--- movable ---
new=thisform.height-(this.fheight-this.cntlist(m.i,3))
IF !this.cntlist(m.i,10) AND m.new>this.limit
xycont.top=m.new
ENDIF
new=thisform.width-(this.fwidth-this.cntlist(m.i,2))
*new=this.cntlist(m.i,2)+(thisform.width-this.fwidth)/2
IF !this.cntlist(m.i,11) AND m.new>this.limit
xycont.left=m.new
ENDIF
ENDIF
NEXT
ENDPROC
ENDDEFINE