Jump to content
LarsJ

Data display functions based on virtual listviews

Recommended Posts

_SQLite_DisplayMult

See "Multiple GUIs" section in top of first post for general information about multiple concurrent and responsive GUIs.

This is copied from the middle of SQLiteDisplay.au3:

; Displays data from a table, view or SELECT statement in a virtual ListView, support for multiple GUIs
Func _SQLite_DisplayMult( _
  $hDB, _             ; An open database, use -1 to use last opened database
  $sSQL, _            ; SELECT statement to be executed or name of a table or view
  $sTitle = "", _     ; GUI title bar text, default title is set to "SQLiteDisplayMult"
  $sHeader = "" _     ; ListView header column names, default is "Row|Col0|Col1|Col2|...|ColN"
  , _                 ;     where Col0-ColN are names from SELECT statement
  $iFlags = 0x0000, _ ; Set additional options through flag values
  $aFeatures = "" )   ; 2D array of feature type/info pairs

  ; $iFlags values
  ; Add required values together
  ; 0x0000 => Left aligned text
  ; 0x0002 => Right aligned text
  ; 0x0004 => Centered text
  ; 0x0008 => Verbose mode
  ; 0x0010 => Half-height ListView
  ; 0x0020 => No grid lines in ListView

  ; $aFeatures parameter
  ; Features available in _SQLite_DisplayMult:
  ;
  ; Features implemented through Common\ files (always usable):
  ;     "ColAlign"    => Column alignment
  ;     "ColWidthMin" => Min. column width
  ;     "ColWidthMax" => Max. column width
  ;     "BackColor"   => Listview background color
  ;     "HdrColors"   => Listview header background colors
  ;     "UserFunc"    => User supplied function
  ;
  ; Features implemented through include files
  ;   End user features:                                         ; Include file:
  ;     "ColFormats"  => Column text formats                     ; <Display function>_ColumnFormats.au3
  ;     "ColColors"   => Column background colors                ; <Display function>_ColumnColors.au3
  ;     "SortRows"    => Sort rows in data source by index       ; <Display function>_SortFuncs.au3
  ;     "SortCols"    => Sort columns in data source by index    ; <Display function>_SortFuncs.au3
  ;     "SortByCols"  => Sort rows by multiple columns           ; <Display function>_SortFuncs.au3
  ;
  ; See DisplayFeatures.txt for docu of features

  ; Error codes in @error
  ; 1 => Invalid database, table, view or SELECT statement passed to function
  ; 3 => Missing include file
  ; 4 => Unsupported feature
  ; 6 => Too many GUIs

Usage of _SQLite_DisplayMult() is demonstrated in Examples\SQLiteDisplayMult\.

Updated zip-file in bottom of first post.


Share this post


Link to post
Share on other sites

SafeArrayDisplayMult

See "Multiple GUIs" section in top of first post for general information about multiple concurrent and responsive GUIs.

This is copied from the middle of SafeArrayDisplay.au3:

; Displays a 1D/2D safearray of variants in a virtual ListView, support for multiple GUIs
Func SafeArrayDisplayMult( _
  $pSafeArray, _      ; Pointer to 1D/2D safearray
  $sTitle = "", _     ; GUI title bar text, default title is set to "SafeArrayDisplayMult"
  $sHeader = "", _    ; ListView header column names, default is "Col0|Col1|Col2|...|ColN"
  $iFlags = 0x0000, _ ; Set additional options through flag values
  $aFeatures = "" )   ; 2D array of feature type/info pairs

  ; $iFlags values
  ; Add required values together
  ; 0x0000 => Left aligned text
  ; 0x0002 => Right aligned text
  ; 0x0004 => Centered text
  ; 0x0008 => Verbose mode
  ; 0x0010 => Half-height ListView
  ; 0x0020 => No grid lines in ListView

  ; $aFeatures parameter
  ; Features available in SafeArrayDisplayMult:
  ;
  ; Features implemented through Common\ files (always usable):
  ;     "ColAlign"    => Column alignment
  ;     "ColWidthMin" => Min. column width
  ;     "ColWidthMax" => Max. column width
  ;     "BackColor"   => Listview background color
  ;     "HdrColors"   => Listview header background colors
  ;     "UserFunc"    => User supplied function
  ;
  ; Features implemented through include files
  ;   End user features:                                         ; Include file:
  ;     "ColFormats"  => Column text formats                     ; <Display function>_ColumnFormats.au3
  ;     "ColColors"   => Column background colors                ; <Display function>_ColumnColors.au3
  ;     "SortRows"    => Sort rows in data source by index       ; <Display function>_SortFuncs.au3
  ;     "SortCols"    => Sort columns in data source by index    ; <Display function>_SortFuncs.au3
  ;     "SortByCols"  => Sort rows by multiple columns           ; <Display function>_SortFuncs.au3
  ;
  ;   Debugging features:                                        ; Include file:
  ;     "DataTypes"   => Data types info                         ; <Display function>_DataTypesInfo.au3
  ;
  ; See DisplayFeatures.txt for docu of features

  ; Error codes in @error
  ; 1 => No valid safearray pointer passed to function
  ;      Non-zero-based safearray passed to function
  ;      Safearray base type not supported
  ; 2 => Larger than 2D array passed to function
  ; 3 => Missing include file
  ; 4 => Unsupported feature
  ; 6 => Too many GUIs

Usage of SafeArrayDisplayMult() is demonstrated in Examples\SafeArrayDisplayMult\.

Updated zip-file in bottom of first post.


Share this post


Link to post
Share on other sites

General information about multiple concurrent and responsive GUIs added to "Multiple GUIs" section in top of first post.

Documentation for _ArrayDisplayMult, CSVfileDisplayMult, _SQLite_DisplayMult and SafeArrayDisplayMult (the functions that supports multiple concurrent and responsive GUIs) added to the four posts above. Four new folders are created under Examples\ with similar examples.

New example: Examples\Mixed functions\Three ArrayDisplay funcs\

 

Global arrays

So far, four global arrays have been used: $aArrayDisplayEx_Info, $aCSVfileDisplay_Info, $aSQLiteDisplay_Info and $aSafeArrayDisplay_Info. In this version, these arrays are replaced by a single global array, $aDataDisplay_Info, implemented in Common\0)GlobalArray.au3.

This means that most files are updated in this version with name changes of the global arrays.

 

Data type ("DataTypes") feature

An array can contain many different types of data, including other arrays (embedded arrays), safearrays (embedded safearrays, shown as pointers), functions, objects and structures (DllStructs). When such data are shown in listview cells, they are shown as empty (blank) cells (safearrays and functions are shown as pointers).

By using the new "DataTypes" feature, special data are displayed as text strings like {Array}, {pSafeArray}, {Function}, {Object} and {Struct}.

Especially arrays containing embedded arrays (arrays of arrays) and safearrays containing embedded safearrays (safearrays of safearrays) are interesting.

To handle embedded arrays and embedded safearrays the "DataTypes" feature implies a new functinality when used in _ArrayDisplayMult and SafeArrayDisplayMult functions (the functions that supports multiple concurrent and responsive GUIs).

If you click in {Array} or {pSafeArray} cells the corresponding array or safearray is opened in a new GUI. This is illustrated in the picture:

qHFrXEC.png

The 2D array contains embedded arrays along the diagonal. The embedded array in element [1][1] is opened in another GUI. This array is a 1D array with two embedded arrays in row 2 and 7. The array in row 7 is opened in a third GUI. Since none of the GUIs are blocking you can continue opening embedded arrays in both the 2D array and the 1D arrays.

The example in the picture is "Examples\ArrayDisplayMult\1) Single features\DataTypes\1) Embedded arrays.au3". Try it.

To find the examples that are relevant for "DataTypes" feature search Examples\ for "DataTypes" in File/Windows Explorer.

Examples\<Display function>Ctrl folders also contains examples in relation to the "DataTypes" feature and multiple concurrent GUIs.

The "DataTypes" feature isn't implemented for CSVfileDisplay or _SQLite_Display functions.

 

Updated zip-file in bottom of first post.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...