FuryCell Posted October 16, 2010 Share Posted October 16, 2010 Very cool. Saved the link as this will definitely come in handy. +5 HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
jeffml Posted October 19, 2010 Share Posted October 19, 2010 I figured out the problem. I have this table generating in a child GUI, so I had to alter the function to accept GUI handle and now it works. Second problem though: why do the cells appear to draw an extra gapwidth every 3 cells? Every 3 cells, I see an extra pixel gap. Does this happen to anyone else? It makes trying to draw borders kind of hard. Especially because the border technically draws behind the cell unless you move it within the function. Maybe this is just behavior on my computer. I appear to be having lots of troubles other people aren't, unless I'm the only one messing around with broders. Thanks for any help. Hi, Your table looks great. Implemented it, then tried to use draw border functionality and got error "Subscript used with non-Array variable." I noticed that it is due to ControlGetPos() not getting the position of a cell control and rather erroring instead. Is anyone else having this issue? ControlGetPos() doesn't pass any extra variables except Control ID. Is this usually a problem? I confirmed with Au3Info.exe that the control ID was correct, but even manually trying to identify the control without calling the draw border function doesn't appear to work. Quick example: $tableArray = _GUICtrlTable_Create(5, 25, 100, 20, $_vCells, $_hCells+1) msgbox(0,"",_GUICtrlTable_CellGetID($tableArray,2,2)) get ID returns value: 30 local $temp $temp = ControlGetPos("[CLASS:Static]","",30) msgbox(0,"",$temp[0] & @CRLF & $temp[1]) ControlGetPos spits out @error = 1, and subsequently referencing temp[0] and temp[1] result in above array error. Anyone? Thanks! Link to comment Share on other sites More sharing options...
andybiochem Posted October 23, 2010 Author Share Posted October 23, 2010 Second problem though: why do the cells appear to draw an extra gapwidth every 3 cells? Every 3 cells, I see an extra pixel gap.Sorry you're having problems with my UDF .Can you post a small script that recreates the gap problem? I've tried a dozen or so different tables, but can't get the error you describe.Are you editing the cells manually via control id's, or are you sticking to the udf functions?Cheers - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
BlueLord Posted October 23, 2010 Share Posted October 23, 2010 Hy, It's posible to use this UDF to display in a table data from a sql database (from a month by example) If it is can somebody to guide me with a small example? Thanks, Link to comment Share on other sites More sharing options...
InvalidSyntax Posted May 22, 2011 Share Posted May 22, 2011 So I am trying to use this UDF is a tab but for some reason the borders disappear. You can see them when resizing the window but thats about it. Link to comment Share on other sites More sharing options...
monoscout999 Posted May 22, 2011 Share Posted May 22, 2011 hi i kwonw is old topic but... why it doesn´t work this? #include <Table.au3> Dim $enumcolors[10][2] $enumcolors[0][0] = "9" ; the first element of the first columns says how many colors are in the list $enumcolors[1][0] = "009D9D9C" $enumcolors[2][0] = "00B2B4B5" $enumcolors[3][0] = "00596475" $enumcolors[4][0] = "00686B6F" $enumcolors[5][0] = "00BCBEBC" $enumcolors[6][0] = "00BDBFBF" $enumcolors[7][0] = "00B9BEBF" $enumcolors[8][0] = "00B9BCBD" $enumcolors[9][0] = "00C1C1BF" $enumcolors[0][1] = "how of each..." ; the first element of the second column says how many of each color are $enumcolors[1][1] = "1" $enumcolors[2][1] = "1" $enumcolors[3][1] = "7" $enumcolors[4][1] = "2" $enumcolors[5][1] = "2" $enumcolors[6][1] = "2" $enumcolors[7][1] = "8" $enumcolors[8][1] = "6" $enumcolors[9][1] = "6" Guicreate("list",-1,-1,-1,-1,-1,0x2000000) GUISetState() GUISetState(@SW_LOCK) $table = _GUICtrlTable_Create(0,0,400,400,ubound($enumcolors),ubound($enumcolors,2), 2) _GUICtrlTable_Set_Text_FromArray($table,$enumcolors) GUISetState(@SW_UNLOCK) while 1 $msj = Guigetmsg() switch $msj case -3 Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
andybiochem Posted June 2, 2011 Author Share Posted June 2, 2011 hi i kwonw is old topic but... why it doesn´t work this? From the function file: ; #FUNCTION# ;=============================================================================== ; Name...........: _GUICtrlTable_Create ; Description ...: Creates a 'table' of label controls, and preps the 'border array' ; Syntax.........: _GUICtrlTable_Create($iLeft, $iTop, $iWidth, $iHeight, $iRows, $iColumns[, $iGapWidth = 1]) ; Parameters ....: $iLeft - Horisontal position of first cell ; $iTop - Vertical position of first cell ; $iWidth - Initial width of each cell ; $iHeight - Initial height of each cell ; $iRows - Number of rows in table ; $iColumns - Number of columns in table ; $iGapWidth - Size (pixels) of gap between each cell (can be zero = no gaps) ; Return values .: Success - Returns array of label IDs for other functions ($ReturnedArray[ROW][COLUMN]) ; Failure - (under construction) ; Notes .........: Rows/Columns are NOT zero-indexed. The first row IS row 1, the first column IS col 1 etc In your code you are creating a table with cells 400x400 pixels in size. The table then does not fill with your data because you are using the zeroeth array elements for storage. This works fine: #include <Table.au3> Dim $enumcolors[11][3] $enumcolors[1][1] = "9" ; the first element of the first columns says how many colors are in the list $enumcolors[2][1] = "009D9D9C" $enumcolors[3][1] = "00B2B4B5" $enumcolors[4][1] = "00596475" $enumcolors[5][1] = "00686B6F" $enumcolors[6][1] = "00BCBEBC" $enumcolors[7][1] = "00BDBFBF" $enumcolors[8][1] = "00B9BEBF" $enumcolors[9][1] = "00B9BCBD" $enumcolors[10][1] = "00C1C1BF" $enumcolors[1][2] = "how of each..." ; the first element of the second column says how many of each color are $enumcolors[2][2] = "1" $enumcolors[3][2] = "1" $enumcolors[4][2] = "7" $enumcolors[5][2] = "2" $enumcolors[6][2] = "2" $enumcolors[7][2] = "2" $enumcolors[8][2] = "8" $enumcolors[9][2] = "6" $enumcolors[10][2] = "6" Guicreate("list",-1,-1,-1,-1,-1,0x2000000) GUISetState() GUISetState(@SW_LOCK) $table = _GUICtrlTable_Create(0,0,70,15,ubound($enumcolors)-1,ubound($enumcolors,2)-1, 2) _GUICtrlTable_Set_Text_FromArray($table,$enumcolors) GUISetState(@SW_UNLOCK) while 1 $msj = Guigetmsg() switch $msj case -3 Exit EndSwitch WEnd So I am trying to use this UDF is a tab but for some reason the borders disappear. You can see them when resizing the window but thats about it. The borders are simply colored labels that are 'sent to the back' of the gui, below the input boxes. It might be that they are bieng sent below the tab control too? Not sure. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
quantum900 Posted August 28, 2011 Share Posted August 28, 2011 I have to say this is my first post here, AutoIT is such a wonderful tool! This UDF is VERY handy. I have one commecnt, question. The column width seems to be a global hard set value. WHat if I need columns of different widths? I noticed tha tif the column wasn't wide enough that it cuts off content instead of auto-resizing. Thanks for all your work with this! Link to comment Share on other sites More sharing options...
ijourneaux Posted November 2, 2011 Share Posted November 2, 2011 I have been using this UDF for a while now. Great Job! Easy to use and very useful. I am finally trying to troubleshoot an intermittant problem where I get the error mentioned earlier in the thread "Subscript used on a non-array variable". The interesting thing is that it doesn't always fail. I would say I get the error message 11 out of every 3-4 time I start my autoit script. Here is a code snippet. Itf it is coing to error out, it happens between "CreateTable 3" and "Create Table 4" Since the problem doesn't occur every time, it is difficult to troubleshoot. ;----- Table Example 4 ----- DebugLog("CreateTable 1") $Table4 = _GUICtrlTable_Create(10, 10, 62, 18, 21, 10, 0) _GUICtrlTable_Set_RowHeight($Table4, 1, 35) _GUICtrlTable_Set_Justify_All($Table4, 1, 1) _GUICtrlTable_Set_TextFont_All($Table4, 8.5, 800, 0, "Tahoma") _GUICtrlTable_Set_CellColor_Row($Table4, 1, 0x555555) _GUICtrlTable_Set_TextColor_All($Table4, 0x555555) _GUICtrlTable_Set_TextColor_Row($Table4, 1, 0xFFFFFF) DebugLog("CreateTable 2") For $row = 3 To $Table4Rows+1 Step 2 _GUICtrlTable_Set_CellColor_Row($Table4, $row, 0xDDDDDD) Next DebugLog("CreateTable 3") _GUICtrlTable_Set_ColumnWidth($Table4, 1, 70) _GUICtrlTable_Set_ColumnWidth($Table4, 3, 80) _GUICtrlTable_Set_ColumnWidth($Table4, 4, 80) _GUICtrlTable_Set_ColumnWidth($Table4, 5, 40) _GUICtrlTable_Set_ColumnWidth($Table4, 6, 30) if($HelioDevice = "Research") then DebugLog("CreateTable 5a") _GUICtrlTable_Set_Text_Row($Table4, 1, "Date,Time,Job,Sample,Side,Rep,Test,Result1,Result2,Result3", ",") Else DebugLog("CreateTable 5b") _GUICtrlTable_Set_Text_Row($Table4, 1, "Date,Time,Job,Sample,Side,Rep,Test,Helio-20,Result2,Result3", ",") EndIf DebugLog("CreateTable 6") _GUICtrlTable_Set_Border_Table($Table4, 0x555555) EndFunc Link to comment Share on other sites More sharing options...
ijourneaux Posted November 3, 2011 Share Posted November 3, 2011 I fiannly had it fail when running in the editor. The error occurs at line 256 in Table.Au3 I copied a snippet from the function. The error occurs at the last line where GUICtrlSetPos($array[$i][$j], $iCurrBoxLeft, $aTemp[1]) The error only seems to happen the first time I run the application involved. The second time I run it, it seems to work correctly Any thoughts on how I can correct table.au3 or atleast work around this issue? $aTemp = ControlGetPos("", "", $array[1][1]) $aTemp2 = ControlGetPos("", "", $array[1][2]) $iGapWidth = $aTemp2[0] - ($aTemp[0] + $aTemp[2]) If $iGapWidth < 0 Then $iGapWidth = 0 For $i = 1 To UBound($array, 1) - 1 $bFirst = True For $j = $iCol To UBound($array, 2) - 1 $aTemp = ControlGetPos("", "", $array[$i][$j]) If $bFirst = True Then $iCurrBoxLeft = $aTemp[0] $bFirst = False Switch $j Case $iCol GUICtrlSetPos($array[$i][$j], $iCurrBoxLeft, $aTemp[1], $iWidth) For $k = 1 To 4 Switch $k Case 1 GUICtrlSetPos($aRetrievedTableBorders[$i][$j][$k], $iCurrBoxLeft, $aTemp[1]) Case 2 GUICtrlSetPos($aRetrievedTableBorders[$i][$j][$k], $iCurrBoxLeft, $aTemp[1], $iWidth) Case 3 GUICtrlSetPos($aRetrievedTableBorders[$i][$j][$k], $iCurrBoxLeft + $iWidth - 1, $aTemp[1]) Case 4 GUICtrlSetPos($aRetrievedTableBorders[$i][$j][$k], $iCurrBoxLeft, $aTemp[1] + $aTemp[3] - 1, $iWidth) EndSwitch Next $iCurrBoxLeft += $iWidth + $iGapWidth Case Else GUICtrlSetPos($array[$i][$j], $iCurrBoxLeft, $aTemp[1]) Link to comment Share on other sites More sharing options...
ijourneaux Posted November 4, 2011 Share Posted November 4, 2011 I was able to locate the problem. In the statement below "", "" referes to the current window which may or may not be the AutoIt window with the table. To try and address this, I modified my script so the window is made active immediately before the table is built. Not an ideal solution but should work in the short term. $aTemp = ControlGetPos("", "", $array[$i][$j]) Link to comment Share on other sites More sharing options...
ijourneaux Posted November 17, 2011 Share Posted November 17, 2011 The Table UDF functionality met a need for a project I was working on. Sometimes my application would crash when populating the table. It turned out that the problem was that the Autoit window with the table control would lose focus that that would cause the application to crash.The problem was the line$aTemp = ControlGetPos("", "", $array[$i][$j])that is peppered through the code. The help file mentions to be careful when using "","" with ControlGetPos.To get around this, I changed the initial call to create the table to include the title of the window.Func _GUICtrlTable_Create($Title, $iLeft, $iTop, $iWidth, $iHeight, $iRows, $iColumns, $iGapWidth = 1) Then I use the title in all of the calls to ControlGetPos in table.au3.Any way, it worked for me. Hopefully it will help someone else. And thanks to the OP for the original UDF. Link to comment Share on other sites More sharing options...
Acanis Posted September 5, 2012 Share Posted September 5, 2012 Hey, great UDF, but if you use your GUISetState() AFTER the creation of the table, you get this error -> F:AutoIt3IncludeTable.au3 (230) : ==> Subscript used with non-Array variable.: $iGapWidth = $aTemp2[0] - ($aTemp[0] + $aTemp[2]) $iGapWidth = $aTemp2^ ERROR That is sad...^^ Cause u dont want to show the GUI, before all is ready?!^^ AND you cant use it with Tabs!!! :/ Link to comment Share on other sites More sharing options...
chun914 Posted May 21, 2013 Share Posted May 21, 2013 any way to make this table editable on the GUI? Link to comment Share on other sites More sharing options...
BugFix Posted May 21, 2013 Share Posted May 21, 2013 any way to make this table editable on the GUI? A way to do this: - mouse click on the label you want to edit - mouse click event checks if control under mouse is one of table-label - if true: get position, size and text from label - create child window including only an input in size of the label, move it over the label - set label text into the input - now you can edit the label text - with hitting <Enter> read input value, set it to label and hide/delete the child - with hitting <Esc> only hide/delete the child Best Regards BugFix Link to comment Share on other sites More sharing options...
hardfloor Posted September 8, 2013 Share Posted September 8, 2013 Hey, great UDF, but if you use your GUISetState() AFTER the creation of the table, you get this error ->F:AutoIt3IncludeTable.au3 (230) : ==> Subscript used with non-Array variable.: $iGapWidth = $aTemp2[0] - ($aTemp[0] + $aTemp[2]) $iGapWidth = $aTemp2^ ERROR That is sad...^^ Cause u dont want to show the GUI, before all is ready?!^^ AND you cant use it with Tabs!!! :/ Hello, Has anyone found a solution to this problem....... I'v the same! Any help please Link to comment Share on other sites More sharing options...
13lack13lade Posted September 9, 2013 Share Posted September 9, 2013 i know this is an old thread but - can this be used to display tables from excel in a gui? Link to comment Share on other sites More sharing options...
BrewManNH Posted September 9, 2013 Share Posted September 9, 2013 If you can put them into the labels this creates I don't see why it wouldn't work that way. This UDF doesn't create a real table, from the description given, it creates a series of label controls that look like a table. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TheSaint Posted September 9, 2013 Share Posted September 9, 2013 (edited) @13lack.... - Better to embed an Excel object .... not that I've tried ... but someone else here is sure to have, so you could be rewarded by doing a search or asking in General Help. @hardfloor - Sorry, but I don't think many would be that interested in this type of Table, so you will no doubt need to work the issue out yourself or try what I said above. Edited September 9, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 19, 2014 Moderators Share Posted April 19, 2014 Hi,While debugging another script, I have discovered why lines appear between the cells on occasion (see post #22 above). It happens when you pass fractional values for the cell dimensions - rounding errors then occur when the display converts to integer pixel values. An example script showing the problem and the solution can be found here. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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