TAutoGet / TGetList

Fonte: source/classes/autoget.prg

TAutoGet inherits from: TGet | TGetList inherits from: TControl

TAutoGet extends TGet with an autocomplete dropdown list that appears as the user types, showing matching items from a data source (array or hash). The dropdown is implemented by TGetList, a companion class that renders a scrollable, gradient-styled item list with hover highlighting and keyboard navigation.

TAutoGet DATA Members

DATATypeDescription
uDataSourceArray/HashSource data for autocomplete suggestions
cFieldCharacter/NumericField or column index within the data source
oListObjectReference to the TGetList dropdown window
nLHeightNumericMaximum height of the dropdown list (default 170)
bCreateListBlockCode block to re-filter the list as the user types
aGradListArrayGradient definition for the list background
aGradItemArrayGradient definition for individual items
nClrLineNumericBorder/separator line color
nClrSelNumericHighlight color for selected item
nClrTextNumericText color in the list

TGetList DATA Members

DATATypeDescription
oGetObjectReference to the parent TAutoGet control
nRowHeightNumericHeight of each list item row in pixels
nMaxHeightNumericMaximum allowed height for the list window
nFirstRowNumericFirst visible row index (for scrolling)
nRowAtNumericCurrently highlighted row

Methods

ClassMethodDescription
TAutoGetNew( nRow, nCol, bSetGet, oWnd, nW, nH, cPict, ... )Create a new autocomplete GET control
TAutoGetReDefine( nId, bSetGet, oWnd, ... )Redefine from a dialog resource
TAutoGetSetList( uDataSource, cField )Set the data source and display field
TAutoGetOpenList( nKey, nFlags )Open the dropdown suggestion list
TAutoGetCloseList()Close the dropdown list
TAutoGetCreateList()Create or refresh the dropdown list
TGetListNew( nTop, nLeft, oWnd, nW, nH, oGet, aGradItem, aGradList, nClrLine, nClrText, nClrSel )Create the dropdown list window
TGetListSetList( uDataSource, cField )Populate the list from array or hash source
TGetListAdjust()Recalculate row height and window size
TGetListGoDown() / GoUp()Navigate the list with keyboard
TGetListPaint() / PaintData( hDC, nAt )Draw the list with gradient backgrounds

Example: Autocomplete GET

#include "FiveWin.ch"

function Main()

   local oWnd, oGet, cVar := Space( 30 )
   local aCities := { "Madrid", "Barcelona", "Valencia", "Sevilla", "Bilbao" }

   DEFINE WINDOW oWnd TITLE "TAutoGet Demo" SIZE 400, 150

   @ 30, 30 AUTOGET oGet VAR cVar ;
      ITEMS aCities ;
      OF oWnd ;
      SIZE 200, 20

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Veja Também