' Rapid-Q by William Yu (c)1999-2000 . ' ================================================================================ ' Upload_il_tuo_script_su_Rapidq.it ' 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 Field Type R/W Default =================== =================== =================== =================== Align INTEGER RW alNone ClientHeight INTEGER RW ClientWidth INTEGER RW CopyMode INTEGER RW cmBlackness Cursor INTEGER RW crDefault Enabled INTEGER RW True Font QFONT W Handle INTEGER RW Height INTEGER RW Hint STRING RW HotTrack INTEGER RW False Left INTEGER RW 0 Parent QFORM/QPANEL/ W QTABCONTROL Pixel 2D ARRAY of INTEGER RW PopupMenu QPOPUPMENU W Sections ARRAY of RW SectionsType SectionsCount INTEGER R ShowHint INTEGER RW False Tag INTEGER RW Top INTEGER RW 0 Width INTEGER RW Visible INTEGER RW True QHeader Methods Method Type Description Params =================== =================== =================== =================== AddSections SUBI Add new sections to STRING, Infinite header Clear SUB Clears all sections 0 Circle SUB (x1%, y1%, x2%, Draw & Fill 6 y2%, c%, fill%) Circle CopyRect D and S are QRECTs, SUB (D, Image, S) Image can be a 3 QImage, QCanvas, or QBitmap Draw SUB (x%, y%, BMP) Draw Bitmap at 3 (X,Y) FillRect SUB (x1%, y1%, x2%, Draws & Fills a 5 y2%, c%) rectangle Line SUB (x1%, y1%, x2%, Draws a line 5 y2%, c%) Paint SUB (x%, y%, c%, Fill Region 4 borderc%) Pset SUB (x%, y%, c%) Pixel plot 3 Rectangle SUB (x1%, y1%, x2%, Draws a rectangle 5 y2%, c%) Repaint SUB Force repainting of 0 header RoundRect SUB (x1%, y1%, x2%, Draws & Fills a 7 y2%, x3%, y3%, c%) rounded rectangle StretchDraw SUB (Rect AS QRECT, Draw BMP and BMP) stretch to fit 2 inside Rect TextHeight FUNCTION (Text$) AS Returns the height, WORD in pixels, of Text$ 1 string TextWidth FUNCTION (Text$) AS Returns the width, WORD in pixels, of Text$ 1 string SUB (Rect AS QRECT, Write text, and TextRect x%, y%, S$, fc%, clip within region 6 bc%) Rect TextOut SUB (x%, y%, S$, Writes text to 5 fc%, bc%) image QHeader Events Event Type Occurs when... Params =================== =================== =================== =================== A header section SUB (Index%, needs to be OnDrawSection Pressed%, Rect AS redisplayed. Header 3 QRECT) section's Style property must be hsOwnerDraw OnMouseDown SUB (Button%, X%, Mouse button held 4 Y%, Shift%) down OnMouseMove SUB (X%, Y%, Mouse moves 3 Shift%) OnMouseUp SUB (Button%, X%, Mouse button is 4 Y%, Shift%) released OnResize VOID Size of header 0 control changes OnSectionClick SUB (Index%) Header section 1 Index% is clicked OnSectionResize SUB (Index%) Header section is 1 resized OnSectionTrack SUB (Index%, Header section is 3 Width%, State%) dragged 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 ' =============================================================================== ' 2003 Holyguard.net - 2007_Abruzzoweb