Question : [AutoIT]   Creating a Control that Looks Like a Spreadsheet

Applications:     AutoIT v3.3.6.1

I've just begun using this program, so my apologies if I am asking a very foolish question...

I am writing a script that automates the creation of a fax log.

There's a GUI that contains a number of GUIControls (radios and buttons) as follows...

GUICreate("Export Type Selection", 500)
GuiCtrlCreateLabel("This script accomodates two types of exports, each with its own set of fields", 10, 10)
GuiCtrlCreateLabel("< Here's where I want the table to go> ", 10, 40 )
GuiCtrlCreateLabel("Which one do you want? ", 10, 160)
GuiCtrlCreateGroup("Export Types", 10, 220, 140, 70)
$Radio_Export1 = GUICtrlCreateRadio("    Failed Fax Log", 20, 240, 120, 20)
$Radio_Export2 = GUICtrlCreateRadio("    Full Fax Log",   20, 260, 120, 20)  
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group
$Button1_Continue = GuiCtrlCreateButton("Continue", 100, 300, 120, 20)
$Button2_Quit     = GuiCtrlCreateButton("Quit",     100, 320, 120, 20)
GUISetState()

At line 3 I want to include the attached table (see below)...
What's the best way to do this?
A series of labels or groups or both?  

Any suggestions would be greatly appreciated.

Gary        
Attachments:
 
I want to add this to the GUI
 
 
I want to add this to the GUI
I want to add this to the GUI
 

Answer : [AutoIT]   Creating a Control that Looks Like a Spreadsheet

Was also going to suggest ListView, however the only issue is that the second line is quite long so would have to placed on another line below, unless you don't mind horizontal scrolling?

You would just use something like:
GUICtrlCreateListViewItem("|Error Code, etc", $listview) as per gimosuby post above.

For me I like to be able to control the look of the table so I would use an HTML Embedded Table (see my example below).

Cheers
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ie.au3>
#include <WindowsConstants.au3>

Example1()
Example2()

Func Example1()
GUICreate("Export Type Selection", 500)
GuiCtrlCreateLabel("This script accomodates two types of exports, each with its own set of fields", 10, 10)
; Start Table using ListView
$ListView = GUICtrlCreateListView("", 10, 40, 480, 80)
    _GUICtrlListView_AddColumn($ListView, "Export Type", 100)
    _GUICtrlListView_AddColumn($ListView, "Fields", 380)
GUICtrlSetFont($ListView, 8.5)
$item1 = GUICtrlCreateListViewItem("Failed Fax Log|Subject, Company, Name, Phone Number/CallerID, Error Code", $ListView)
$item2 = GUICtrlCreateListViewItem("Full Fax Log|Subject, Company, Name, Phone Number/CallerId, Date, Time, Duration, Type, Error Code, Status, Status Message, Pages, Pages S/R, Retries, Resolution, Speed", $ListView)
; End Table using ListView
GuiCtrlCreateLabel("Which one do you want? ", 10, 160)
$Radio_Export1 = GUICtrlCreateRadio("    Failed Fax Log", 20, 240, 120, 20)
$Radio_Export2 = GUICtrlCreateRadio("    Full Fax Log",   20, 260, 120, 20)
GUICtrlCreateGroup ("",-99,-99,1,1)
$Button1_Continue = GuiCtrlCreateButton("Continue", 100, 300, 120, 20)
$Button2_Quit     = GuiCtrlCreateButton("Quit",     100, 320, 120, 20)
GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
EndFunc

Func Example2()
$GUI_IECREATE = _IECreateEmbedded()
GUICreate("Export Type Selection", 500)
GuiCtrlCreateLabel("This script accomodates two types of exports, each with its own set of fields", 10, 10)
; Start Table using HTML
$HTM_IECREATE = ''
$HTM_IECREATE &= '<html>'
$HTM_IECREATE &= '<head>'
$HTM_IECREATE &= '<style type="text/css">'
$HTM_IECREATE &= '<!--'
$HTM_IECREATE &= 'body {font-family:Arial,Helvetica,sans-serif;margin:5px;padding:0px;border:1px solid #CCC;}'
$HTM_IECREATE &= 'table {border-color: #CCC;border-width: 0 0 1px 1px;border-style: solid;font-size:12px;}'
$HTM_IECREATE &= 'td {border-color: #CCC;border-width: 1px 1px 0 0;border-style: solid;margin: 0;padding: 5px;}'
$HTM_IECREATE &= '-->'
$HTM_IECREATE &= '</style>'
$HTM_IECREATE &= '</head>'
$HTM_IECREATE &= '<body>'
$HTM_IECREATE &= '<table border="0" cellspacing="0" cellpadding="0" width="450">'
$HTM_IECREATE &= '<tr>'
$HTM_IECREATE &= '<td width="100"><strong>Export Type</strong></td>'
$HTM_IECREATE &= '<td width="350"><strong>Fields</strong></td>'
$HTM_IECREATE &= '</tr>'
$HTM_IECREATE &= '<tr>'
$HTM_IECREATE &= '<td valign="top">Failed Fax Log</td>'
$HTM_IECREATE &= '<td valign="top">Subject, Company, Name, Phone Number/CallerID, Error Code</td>'
$HTM_IECREATE &= '</tr>'
$HTM_IECREATE &= '<tr>'
$HTM_IECREATE &= '<td valign="top">Full Fax Log</td>'
$HTM_IECREATE &= '<td valign="top">Subject, Company, Name, Phone Number/CallerId, Date, Time, Duration, Type, Error Code, Status, Status Message, Pages, Pages S/R, Retries, Resolution, Speed</td>'
$HTM_IECREATE &= '</tr>'
$HTM_IECREATE &= '</table>'
$HTM_IECREATE &= '</body>'
$HTM_IECREATE &= '</html>'
$OBJ_IECREATE = GUICtrlCreateObj($GUI_IECREATE, 10, 40, 480, 138)
_IENavigate($GUI_IECREATE, 'about:blank')
_IEDocWriteHTML($GUI_IECREATE, $HTM_IECREATE)
; End Table using HTML
GuiCtrlCreateLabel("Which one do you want? ", 10, 180)
$Radio_Export1 = GUICtrlCreateRadio("    Failed Fax Log", 20, 240, 120, 20)
$Radio_Export2 = GUICtrlCreateRadio("    Full Fax Log",   20, 260, 120, 20)
GUICtrlCreateGroup ("",-99,-99,1,1)
$Button1_Continue = GuiCtrlCreateButton("Continue", 100, 300, 120, 20)
$Button2_Quit     = GuiCtrlCreateButton("Quit",     100, 320, 120, 20)
GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
EndFunc
Random Solutions  
 
programming4us programming4us