Guidance
指路人
g.yi.org
software / RapidQ / RQ Doc / html / qheader.html

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Appendix A: QHEADER
Rapid-Q Documentation by William Yu (c)1999 Appendix A: QHEADER


QHEADER Component

QHeader is a set of column headers that the user can resize at runtime.

QHeader Internal Types
   TYPE SectionsType       '' ie. Header.Sections(0).Caption
     Alignment AS INTEGER  '' Default taLeftJustify
     AllowClick AS INTEGER '' True
     Caption AS STRING
     MaxWidth AS INTEGER   '' Default  10000
     MinWidth AS INTEGER   '' Default 0
     Style AS INTEGER      '' Default hsText
     Width AS INTEGER      '' Default 50
   END TYPE
QHeader Properties
FieldTypeR/WDefault




AlignINTEGERRWalNone
ClientHeightINTEGERRW
ClientWidthINTEGERRW
CopyModeINTEGERRWcmBlackness
CursorINTEGERRWcrDefault
EnabledINTEGERRWTrue
FontQFONTW
HandleINTEGERRW
HeightINTEGERRW
HintSTRINGRW
HotTrackINTEGERRWFalse
LeftINTEGERRW0
ParentQFORM/QPANEL/QTABCONTROLW
Pixel2D ARRAY of INTEGERRW
PopupMenuQPOPUPMENUW
SectionsARRAY of SectionsTypeRW
SectionsCountINTEGERR
ShowHintINTEGERRWFalse
TagINTEGERRW
TopINTEGERRW0
WidthINTEGERRW
VisibleINTEGERRWTrue

QHeader Methods
MethodTypeDescriptionParams




AddSectionsSUBIAdd new sections to headerSTRING, Infinite
ClearSUBClears all sections0
CircleSUB (x1%, y1%, x2%, y2%, c%, fill%)Draw & Fill Circle6
CopyRectSUB (D, Image, S)D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap3
DrawSUB (x%, y%, BMP)Draw Bitmap at (X,Y)3
FillRectSUB (x1%, y1%, x2%, y2%, c%)Draws & Fills a rectangle5
LineSUB (x1%, y1%, x2%, y2%, c%)Draws a line5
PaintSUB (x%, y%, c%, borderc%)Fill Region4
PsetSUB (x%, y%, c%)Pixel plot3
RectangleSUB (x1%, y1%, x2%, y2%, c%)Draws a rectangle5
RepaintSUBForce repainting of header0
RoundRectSUB (x1%, y1%, x2%, y2%, x3%, y3%, c%)Draws & Fills a rounded rectangle7
StretchDrawSUB (Rect AS QRECT, BMP)Draw BMP and stretch to fit inside Rect2
TextHeightFUNCTION (Text$) AS WORDReturns the height, in pixels, of Text$ string1
TextWidthFUNCTION (Text$) AS WORDReturns the width, in pixels, of Text$ string1
TextRectSUB (Rect AS QRECT, x%, y%, S$, fc%, bc%)Write text, and clip within region Rect6
TextOutSUB (x%, y%, S$, fc%, bc%)Writes text to image5

QHeader Events
EventTypeOccurs when...Params




OnDrawSectionSUB (Index%, Pressed%, Rect AS QRECT)A header section needs to be redisplayed. Header section's Style property must be hsOwnerDraw3
OnMouseDownSUB (Button%, X%, Y%, Shift%)Mouse button held down4
OnMouseMoveSUB (X%, Y%, Shift%)Mouse moves3
OnMouseUpSUB (Button%, X%, Y%, Shift%)Mouse button is released4
OnResizeVOIDSize of header control changes0
OnSectionClickSUB (Index%)Header section Index% is clicked1
OnSectionResizeSUB (Index%)Header section is resized1
OnSectionTrackSUB (Index%, Width%, State%)Header section is dragged3


QHeader Examples
$TYPECHECK ON
$INCLUDE "RAPIDQ.INC"

DECLARE SUB DrawSection (Index AS INTEGER, Pressed AS INTEGER, Rect AS QRECT, Sender AS QHEADER)
DECLARE SUB SectionTrack (Index AS INTEGER, Width AS INTEGER, State AS INTEGER, Sender AS QHEADER)

CREATE Form AS QFORM
    Caption = "QHeader example"
    Center
    CREATE Header AS QHEADER
        AddSections "1", "2", "3"
        Sections(1).AllowClick = FALSE
        Sections(0).Style = hsOwnerDraw
        Sections(0).Width = 100
        Sections(1).Style = hsOwnerDraw
        Sections(2).Style = hsOwnerDraw
        OnDrawSection = DrawSection
        OnSectionTrack = SectionTrack
    END CREATE
    CREATE ListBox1 AS QLISTBOX
        Align = alLeft
        Width = 100
        AddItems "1. Rapid-Q", "2. Taxes"
    END CREATE
    CREATE StatusBar AS QSTATUSBAR
        SimplePanel = TRUE
        SimpleText = "Not moving"
    END CREATE
    ShowModal
END CREATE

SUB DrawSection (Index AS INTEGER, Pressed AS INTEGER, Rect AS QRECT, Sender AS QHEADER)
    Sender.TextOut(Rect.Left+5,Rect.Top+1, STR$(Index+1), &HFF0000, -1)
    SELECT CASE Index
        CASE 0
            Sender.FillRect(Rect.Left+20,Rect.Top+2,Rect.Right-20,Rect.Bottom-2, &H00FF00)
        CASE 1
            Sender.Circle(Rect.Left+20,Rect.Top+2,Rect.Right-20,Rect.Bottom-2, &HFF, &HFF)
        CASE 2
    END SELECT
END SUB

SUB SectionTrack (Index AS INTEGER, Width AS INTEGER, State AS INTEGER, Sender AS QHEADER)
    StatusBar.SimpleText = "Moving "+STR$(Width)
    SELECT CASE Index
        CASE 0
            ListBox1.Width = Width
    END SELECT
END SUB

Prev Component Contents Next Component
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2024-4-16  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2015-12-25 19:42:39