Documentation component by D.Glodt (c)2000-2001 Appendix A: QDrawFocus

QDrawFocus Component

QDrawFocus is a focus to use as selection in graphic components.

 

 

QDrawFocus Properties
Field Type R/W Défault





Left SHORT R
Position x of focus when it is visible
Top SHORT R
Position y of focus when it is visible 
Width SHORT R
Width of focus when it is visible
Height SHORT R
Height of focus when it is visible
Move BOOLEAN R FALSE
At true if focus has moved.
Visible BOOLEAN RW FALSE
At true if focus is visible
Inside BOOLEAN R FALSE
At true if cursor is inside the focus
NoResize BOOLEAN RW FALSE
No resize when the value is true
ShowCursor BOOLEAN RW TRUE
Change the cursor state following the actions on focus

QDrawFocus Methods
Method Type Description Params





Remove SUB(handle&) Remove the focus 1
Start SUB(handle&,x%,y%) Start the drawing of focus 3
Draw SUB(handle&,x%,y%,flagDraw%) Draw the focus 4
Stop SUB(handle&,flagRemove%) Stop the drawing of focus 2

QDrawFocus Events
Event Type Occurs when... Params





QDrawFocus Examples
'==============================================================================================
' the Start method gives the starting point of focus
' the Draw method draws the focus , moves it or the resize if this one is already visible and if flagDraw is at true,
' if flagDraw is at false only the state of the cursor changes
' the Stop method gives the cursor at its state of origin after action on the focus and removes the focus if the flagRemove is at true.
'===============================================================================================
$TYPECHECK ON
$Include "Rapidq.inc"
$include "Object\QDrawFocus.inc"

declare sub StartFocus(button as short,x as short,y as short)
declare sub StopFocus(x as short,y as short)
declare sub DrawFocus(x as short,y as short)
declare sub paint
declare sub resize
dim focus as QDrawFocus
dim flag as byte

CREATE Form AS QFORM
  Caption = "Form1"
  Width = 686
  Height = 452
  Center
  OnResize=resize
  CREATE Canvas1 AS QCANVAS
    Left = 0
    Top = 0
    Width = 678
    Height = 425
    OnPaint=paint
    OnMouseDown=StartFocus
    OnMouseUp=StopFocus
    OnMouseMove=DrawFocus
  END CREATE
END CREATE

Form.ShowModal

Sub StartFocus(button as short,x as short,y as short)
  focus.start(Canvas1.handle,x,y)
  flag=true
End Sub

Sub DrawFocus(x as short,y as short)
  focus.draw(Canvas1.handle,x,y,flag)
End Sub

Sub StopFocus(x as short,y as short)
  focus.stop(Canvas1.handle,false)
  flag=false
End Sub

Sub paint
  if focus.visible then
    focus.visible=false
    Canvas1.fillrect(0,0,1000,1000,&HFFFFFF)
    focus.start(Canvas1.handle,focus.left,focus.top)
    focus.draw(Canvas1.handle,focus.left+focus.width,focus.top+focus.height,true)
  else
    Canvas1.fillrect(0,0,1000,1000,&HFFFFFF)
  end if
end sub

sub resize
  canvas1.repaint
end sub
 

Hosted by uCoz