' Rapid-Q by William Yu (c)1999-2000 . ' ================================================================================ ' Upload_il_tuo_script_su_Rapidq.it ' Qstringgrid ****** QSTRINGGRID Component ****** QStringGrid allows you to present textual data in a tabular format. QStringGrid Properties Field Type R/W Default =================== =================== =================== =================== Align INTEGER RW alNone Align determines how the control aligns within its parent control. BorderStyle INTEGER RW bsSingle Cell 2D ARRAY of STRING RW Cell(X, Y) is an array of strings, one string for each cell in the grid. X = Column, Y = Row Col INTEGER RW Col is the index of the column that contains the selected cell. ColCount INTEGER RW 5 Color INTEGER RW ColumnList ARRAY of STRING RW ColumnList maintains a list of strings deliminated by LF for use in Columned lists. ColumnStyle ARRAY of INTEGER RW gcsNone ColumnStyle determines the style of each column. 0 = gcsList -- Column with a drop-down list for each item 1 = gcsEllipsis -- Column with an ellipsis button for each item 2 = gcsNone -- Normal column ColWidths ARRAY of INTEGER RW ColWidths is an indexed array giving the width in pixels of all the columns in the grid. Cursor INTEGER RW crDefault DefaultColWidth INTEGER RW 64 DefaultRowHeight INTEGER RW 24 EditorMode INTEGER RW Enabled INTEGER RW True FixedColor INTEGER RW FixedCols INTEGER RW 1 FixedColss is the number of columns on the left of the grid that cannot be scrolled. FixedRows INTEGER RW 1 FixedRows is the number of rows on the top of the grid that cannot be scrolled. Font QFONT W GridHeight INTEGER RW GridLineWidth INTEGER RW 1 GridWidth INTEGER RW Handle INTEGER R Height INTEGER RW Hint STRING RW Left INTEGER RW 0 LeftCol INTEGER RW Parent QFORM/QPANEL/ W QTABCONTROL PopupMenu QPOPUPMENU W Row INTEGER RW Row is the index of the row that contains the selected cell. RowCount INTEGER RW 5 RowHeights ARRAY of INTEGER RW RowHeights is an indexed array giving the height in pixels of all the rows in the grid. ScrollBars INTEGER RW ssBoth Separator STRING RW Separator determines how the stringgrid should parse (ie. read/write) grid data. For example, you can save the grid data to a file, with each item deliminated by the Separator. ShowHint INTEGER RW False TabOrder INTEGER RW TabStops ARRAY of INTEGER RW Tag INTEGER RW Top INTEGER RW 0 TopRow INTEGER RW Visible INTEGER RW True VisibleColCount INTEGER R VisibleRowCount INTEGER R Width INTEGER RW QStringGrid Methods Method Type Description Params =================== =================== =================== =================== AddOptions SUBI Add options to INTEGER, Infinite string grid DeleteCol SUB (Column%) Deletes/Remove a 1 column DeleteRow SUB (Row%) Deletes/Remove a 1 row DelOptions SUBI Delete options from INTEGER, Infinite string grid 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 InsertCol SUB (Column%) Inserts a blank 1 column InsertRow SUB (Row%) Inserts a blank row 1 Line SUB (x1%, y1%, x2%, Draws a line 5 y2%, c%) SUB (File$, LoadFromFile RowOffset%, Loads table from 4 ColOffset%, file w/Separator MaxRows%) SUB (S AS QFileStream/ LoadFromStream QMemoryStream, Loads table from 4 RowOffset%, stream w/Separator ColOffset%, MaxRows%) 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 stringgrid RoundRect SUB (x1%, y1%, x2%, Draws & Fills a 7 y2%, x3%, y3%, c%) rounded rectangle SUB (File$, SaveToFile RowOffset%, Saves table to file 4 ColOffset%, w/Separator MaxRows%) SUB (S AS QFileStream/ SaveToStream QMemoryStream, Saves table to 4 RowOffset%, stream w/Separator ColOffset%, MaxRows%) SwapCols SUB (Col1%, Col2%) Swap two columns 2 SwapRows SUB (Row1%, Row2%) Swap two rows 2 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 TextRect SUB (Rect AS QRECT, Write text, and x%, y%, S$, fc%, clip within region 6 bc%) Rect TextOut SUB (x%, y%, S$, Writes text to cell 5 fc%, bc%) QStringGrid Events Event Type Occurs when... Params =================== =================== =================== =================== OnDrawCell SUB (Col%, Row%, Cells need to be 4 State%, R AS QRect) redrawn OnEllipsisClick SUB (Col%, Row%) Pull down list is 2 clicked OnKeyDown SUB (Key AS Word, Key held down 2 Shift AS INTEGER) OnKeyPress SUB (Key AS BYTE) User presses a key 1 OnKeyUp SUB (Key AS Word, User releases a key 2 Shift AS INTEGER) Pull down list is SUB (Col%, Row%, clicked. S is a OnListDropDown BYREF S AS STRING) string with items 3 separated by a new line character. OnSelectCell SUB (Col%, Row%, User has selected a 3 CanSelect%) cell OnSetEditText SUB (Col%, Row%, User has changed 3 Value$) contents of cell QStringGrid Examples CREATE Form AS QForm CREATE Grid AS QStringGrid Cell(1,1) = "hello" END CREATE Center ShowModal END CREATE '------------------------------------------------------------------ ' Pulldown list example $INCLUDE "RAPIDQ.INC" $ESCAPECHARS ON CONST AgeList = "10\n11\n12\n13\n14\n15\n16\n17\n18\n19" SUB EllipsisClick (Col AS LONG, Row AS LONG, Sender AS QSTRINGGRID) Sender.Cell(Col, Row) = "Comments"+STR$(Row) END SUB CREATE Form AS QFORM CREATE Grid AS QSTRINGGRID Align = alClient AddOptions(goEditing) FixedRows = 1 FixedCols = 0 ColCount = 3 RowCount = 5 DefaultRowHeight = 20 ColumnStyle(0) = gcsList ColumnStyle(1) = gcsEllipsis ColumnList(0) = AgeList Cell(0,0) = " Age" Cell(1,0) = " Comments" OnEllipsisClick = EllipsisClick END CREATE Caption = "Dropdown list example" Center ShowModal END CREATE ' =============================================================================== ' 2003 Holyguard.net - 2007_Abruzzoweb