rakudave Posted April 28, 2006 Share Posted April 28, 2006 (edited) i like the listview-stuff, but i needed something else...perhaps someone likes it...let me know what you think!EXAMPLE:#include <GUIConstants.au3> #include <_GUICtrlCreateTable.au3> GUICreate("my table",300,180) $ex = _GUICtrlCreateTable(25, 25, 4, 6, 60, 20) GUICtrlSetData($ex[2][1],"yeah!") GUICtrlSetData($ex[3][2],"it") GUICtrlSetData($ex[4][3],"works!") $combined = _GUICtrlTableSpan($ex, 2,4,3,5) GUICtrlSetData($combined,"even combining" & @crlf & "cells is possible!") $combined2 = _GUICtrlTableSpan($ex, 4,5,4,6) GUICtrlSetData($combined2,"...another one...") GUISetState () do $msg = guigetmsg() until $msg = $GUI_EVENT_CLOSEthe UDF:expandcollapse popup#include-once ;============================================================================= ; ; Function Name: _GUICtrlCreateTable() ; ; Description: Creates a table, resembling the html-style ; ; Syntax: _GUICtrlCreateTable($left, $top, $rows, $cols, $width, $height, [$border]) ; ; Parameter(s); $left = left side of the table ; $top = top of the table ; $rows = number of rows to be created ; $cols = number of columns to be created ; $width = width of ONE cell ; $height = height of ONE cell ; $border = [optional] thickness of the border, default: 1 ; ; Return Value(s): array[rows][cols], used to set values with GUICtrlSetData ; ; Note: do NOT overwrite the returned array[0][0], it contains data for the _GUICtrlTableSpan() function ; ; Author: rakudave <rakudave@gmx.net> ;============================================================================= Func _GUICtrlCreateTable($_left, $_top, $_rows, $_cols, $_width, $_height, $_border = 1) Local $_table[$_rows +1][$_cols +1] $_table[0][0] = $_left & "|" & $_top & "|" & $_rows & "|" & $_cols & "|" & $_width & "|" & $_height & "|" & $_border GUICtrlCreateLabel("",$_left,$_top, $_width * $_rows + $_rows * $_border + $_border +2, $_height * $_cols + $_cols * $_border + $_border +2) If $_border > 0 then GUICtrlSetStyle(-1,$SS_BLACKFRAME) for $x = 1 to $_rows for $y = 1 to $_cols GUICtrlCreateLabel("",($x -1) * $_width + $_left + $x * $_border +1,($y -1) * $_height + $_top + $y * $_border +1, $_width, $_height) If $_border > 0 then GUICtrlSetStyle(-1,$SS_BLACKFRAME) $_table[$x][$y] = GUICtrlCreateLabel("",($x -1) * $_width + $_left + $x * $_border +4,($y -1) * $_height + $_top + $y * $_border +4, $_width -6, $_height -6) next next return $_table Endfunc ;============================================================================= ; ; Function Name: _GUICtrlTableSpan() ; ; Description: this function is used to unite some cells created by _GUICtrlCreateTable() ; ; Syntax: _GUICtrlTableSpan($id, $from_row, $from_col, $to_row, $to_col) ; ; Parameter(s); $id = the parameter returned by _GUICtrlCreateTable() ; $from_row = left index of the first cell to unite ; $from_col = top index of the first cell ; $to_row = left index of the last cell ; $to_col = top index of the last cell ; ; Return Value(s): the new parameter of the combined cell ; ; Author: rakudave <rakudave@gmx.net> ;============================================================================= Func _GUICtrlTableSpan($_id, $from_row, $from_col, $to_row, $to_col) $_tabledata = Stringsplit($_id[0][0],"|");$_left, $_top, $_rows, $_cols, $_width, $_height, $_border for $x = $from_row to $to_row for $y = $from_col to $to_col GUICtrlDelete($_id[$x][$y]) next next GUICtrlCreateLabel("",$_tabledata[1] + ($from_row - 1) * $_tabledata[5] + $from_row * $_tabledata[7] +1, $_tabledata[2] + ($from_col - 1) * $_tabledata[6] + $from_col * $_tabledata[7] +1,($to_row - $from_row + 1) * $_tabledata[5] + ($to_row -$from_row) * $_tabledata[7],($to_col - $from_col + 1) * $_tabledata[6] + ($to_col - $from_col) * $_tabledata[7]) If $_tabledata[7] > 0 then GUICtrlSetStyle(-1,$SS_BLACKFRAME) GUICtrlCreateLabel("",$_tabledata[1] + ($from_row - 1) * $_tabledata[5] + $from_row * $_tabledata[7] +2, $_tabledata[2] + ($from_col - 1) * $_tabledata[6] + $from_col * $_tabledata[7] +2,($to_row - $from_row + 1) * $_tabledata[5] + ($to_row -$from_row) * $_tabledata[7] -2,($to_col - $from_col + 1) * $_tabledata[6] + ($to_col - $from_col -1) * $_tabledata[7] + $_tabledata[7] -2) $_id[$from_row][$from_col] = GUICtrlCreateLabel("",$_tabledata[1] + ($from_row - 1) * $_tabledata[5] + $from_row * $_tabledata[7] +4, $_tabledata[2] + ($from_col - 1) * $_tabledata[6] + $from_col * $_tabledata[7] + $_tabledata[7] +2,($to_row - $from_row + 1) * $_tabledata[5] + ($to_row -$from_row -1) * $_tabledata[7] -4,($to_col - $from_col + 1) * $_tabledata[6] + ($to_col - $from_col -1) * $_tabledata[7] -4) return $_id[$from_row][$from_col] Endfuncand here's a screnshot of the example: Edited April 30, 2006 by rakudave Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
taurus905 Posted April 28, 2006 Share Posted April 28, 2006 rakudave, That looks great! Does it work with colors? Can you show another example? taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
Busti Posted April 28, 2006 Share Posted April 28, 2006 teh hell thats great oO n1 My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity Link to comment Share on other sites More sharing options...
rakudave Posted April 29, 2006 Author Share Posted April 29, 2006 (edited) thanks! yes, colors work as usual: ;;;;;;;;;;;;;; EXAMPLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #include <GUIConstants.au3> #include <_GUICtrlCreateTable.au3> GUICreate("my table",300,180) $ex = _GUICtrlCreateTable(25, 25, 4, 6, 60, 20) GUICtrlSetData($ex[2][1],"let's add") GUICtrlSetData($ex[3][2],"some") GUICtrlSetData($ex[4][3],"colors!!!") GUICtrlSetBkColor($ex[2][1],0x00ff00) GUICtrlSetBkColor($ex[3][2],0xff0000) GUICtrlSetBkColor($ex[4][3],0x0000ff) GUICtrlSetColor($ex[4][3],0xffffff) $combined = _GUICtrlTableSpan($ex, 2,4,3,5) GUICtrlSetData($combined,"even combining" & @crlf & "cells is possible!") GUISetState () do $msg = guigetmsg() until $msg = $GUI_EVENT_CLOSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Edited April 30, 2006 by rakudave Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
Busti Posted April 29, 2006 Share Posted April 29, 2006 how did you get the idea to to that oO My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity Link to comment Share on other sites More sharing options...
rakudave Posted April 29, 2006 Author Share Posted April 29, 2006 ahm, I intended to do some password-security calculations and do the output in a table. since there was no solution for my need, i did it myself... ;-) I'm not against the listview-function, but i needed a diferent style... Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
RazerM Posted April 29, 2006 Share Posted April 29, 2006 i don't have time to try this right now but it looks awesome!! My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 29, 2006 Share Posted April 29, 2006 wow this is great,could be great for people trying to organize stuff in excel but they can now make their own Link to comment Share on other sites More sharing options...
RazerM Posted April 29, 2006 Share Posted April 29, 2006 i just tried this!! i really like it. I like the way the array is used for the rows and columns My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 29, 2006 Share Posted April 29, 2006 u should make it exportable to html Link to comment Share on other sites More sharing options...
rakudave Posted April 29, 2006 Author Share Posted April 29, 2006 thanks... i'll think about the html-export... Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
rakudave Posted April 29, 2006 Author Share Posted April 29, 2006 ok, I could do it, but does anyone need that addon? Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
ConsultingJoe Posted April 30, 2006 Share Posted April 30, 2006 ok, I could do it, but does anyone need that addon?very good job, very useful Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
GrungeRocker Posted April 30, 2006 Share Posted April 30, 2006 yes the html-output would be nice.... [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
rakudave Posted April 30, 2006 Author Share Posted April 30, 2006 ok, i'll see what i can do... update: minor change in the _guictrlcreatetable function Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
RazerM Posted May 1, 2006 Share Posted May 1, 2006 I have used this already in my Cool text Client. Very good. i like the border thickness. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
rakudave Posted May 3, 2006 Author Share Posted May 3, 2006 thanks... Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table Link to comment Share on other sites More sharing options...
MarioX Posted April 18, 2007 Share Posted April 18, 2007 Probably a dumb question... How to center the text inside the cells ? Thanks for any advice! Mario Link to comment Share on other sites More sharing options...
laurent68 Posted July 17, 2008 Share Posted July 17, 2008 Fabulous, i m looking for a Grid / Table like this for a long time. Why not include with AutoIt ? Many thanks Laurent Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now