Jump to content

Recommended Posts

Posted (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_CLOSE

the UDF:

#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]
Endfunc

and here's a screnshot of the example:

Posted Image

Edited by rakudave
Posted (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 by rakudave
Posted

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.
Posted

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.
Posted

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.
  • 11 months later...
  • 1 year later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...