Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rectangular Area Selector
Message
From
21/06/2003 03:58:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00802372
Message ID:
00802555
Views:
24
>How can I draw a box as a rectangular area selector such that the borderlines of the box do not leave line remnants around as I move around the page? We want to do something akin to the Form Designer's area selector that allow the user to select all objects found within the area.
>
>The Line method in VB works all right, but in FoxPro it leaves line remants all over.
>
>
>Thanks,
>-Steve

Not perfect :
*Form.MouseDown
LPARAMETERS nButton, nShift, nXCoord, nYCoord
if nButton = 1
 this.newobject("SPanel","SelPanel","Selector.prg","",;
     nXCoord,nYCoord)
 this.spanel.visible=.t.
endif	

*Form.MouseUp
LPARAMETERS nButton, nShift, nXCoord, nYCoord
If nButton=1 and Type('this.Spanel')='O'
 this.Spanel.EndSelect()
 this.SelObjects()
 this.RemoveObject('Spanel')
endif

*Form custom selobjects
With this.SPanel
 MessageBox(;
   Transform(.SelLeft)+'/'+;
   Transform(.SelTop)+'/'+;
   Transform(.SelHeight)+'/'+;
   Transform(.SelWidth) )
endwith

*Selector.Prg
Define Class selpanel As Container
  BackStyle = 0
  BorderWidth=0
  StartX = 0
  StartY = 0
  SelLeft   = 0
  SelTop    = 0
  SelHeight = 0
  SelWidth  = 0
  Name = "selpanel"

  Add Object SelectorBox As Container With ;
    BackStyle = 0
  Add Object SelShield As Container With ;
    BackStyle = 0,;
    BorderWidth = 0

  Procedure Init
    Lparameters tnX, tnY
    This.StartX = tnX
    This.StartY = tnY
    With Thisform
      This.Width = .Width
      This.Height = .Height
      This.SelShield.Width = .Width
      This.SelShield.Height = .Height
    Endwith
    With This.SelectorBox
      .Left = tnX
      .Top = tnY
      .Height = 1
      .Width = 1
    Endwith
  Endproc

  Procedure SelShield.MouseMove
    Lparameters nButton, nShift, nXCoord, nYCoord
    If nButton = 1
      With This.Parent.SelectorBox
        .Left   = Min(nXCoord, This.Parent.StartX)
        .Top    = Min(nYCoord, This.Parent.StartY)
        .Height = Abs(nYCoord - This.Parent.StartY)
        .Width  = Abs(nXCoord - This.Parent.StartX)
      Endwith
    Endif
  Endproc
  Procedure SelShield.MouseLeave
    Lparameters nButton, nShift, nXCoord, nYCoord
    Thisform.MouseUp(nButton, nShift, nXCoord, nYCoord)
  Endproc

  Procedure EndSelect
    Lparameters tlDestroy
    With This.SelectorBox
      This.SelLeft   = .Left
      This.SelTop    = .Top
      This.SelHeight = .Height
      This.SelWidth  = .Width
    Endwith
    This.RemoveObject('SelectorBox')
    This.RemoveObject('SelShield')
    If tlDestroy
      Thisform.RemoveObject(This.Name)
    Endif
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform