 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Sun Jun 03, 2007 12:00 pm Post subject: [module] SpreadSheet 0.0.1.4.96 |
|
|
Another gold control is initialised with AHK. (SprSht.dll, 42.5KB, by KetilO, www.radasm.com )
Download
Current API (45 functions)
| Code: | SS_Add(hwnd,x=0,y=0,w=200,h=100,style="VSCROLL HSCROLL")
SS_BlankCell(hCtrl, col, row)
SS_CreateCombo(hCtrl, string="")
SS_DeleteCol(hCtrl, col)
SS_DeleteRow(hCtrl, row)
SS_ExpandCell(hCtrl, left, top, right, bottom )
SS_GetCell(hCtrl, col, row, i)
SS_GetCellRect(hCtrl, ByRef top, ByRef left, ByRef right, ByRef bottom)
SS_GetCellType(hCtrl, col, row)
SS_GetColCount(hCtrl)
SS_GetColWidth(hCtrl, col)
SS_GetCurrentCell(hCtrl, ByRef col, ByRef row)
SS_GetCurrentWin(hCtrl)
SS_GetLockCol(hCtrl)
SS_GetLockRow(hCtrl)
SS_GetMultiSel(hCtrl, ByRef top, ByRef left, ByRef right, ByRef bottom)
SS_GetRowCount(hCtrl)
SS_GetRowHeight(hCtrl, row)
SS_ImportLine(hCtrl, dataLine, sepChar=";")
SS_InsertCol(hCtrl, col)
SS_InsertRow(hCtrl, row)
SS_LoadFile(hCtrl, file)
SS_NewSheet(hCtrl)
SS_ReCalc(hCtrl)
SS_SaveFile(hCtrl, file)
SS_SetCell(hCtrl, col, row, o1="", o2="", o3="", o4="", o5="", o6="", o7="", o8="", o9="", o10="")
SS_ScrollCell(hCtrl)
SS_SetCellString(hCtrl, txt)
SS_SetColCount(hCtrl, nCols)
SS_SetColWidth(hCtrl, col, width)
SS_SetCurrentCell(hCtrl, col, row)
SS_SetCurrentWin(hCtrl, nWin)
SS_SetFont(hCtrl, idx, pFont)
SS_SetGlobal(hCtrl, g, cell="", colhdr="", rowhdr="", winhdr="")
SS_SetHandler( func)
SS_SetLockCol(hCtrl, cols)
SS_SetLockRow(hCtrl, rows)
SS_SetMultiSel(hCtrl, left, top, right, bottom )
SS_SetRowCount(hCtrl, nRows)
SS_SetRowHeight(hCtrl, row, height)
SS_SplittClose(hCtrl)
SS_SplittHor(hCtrl)
SS_SplittVer(hCtrl)
SS_GetCellData
SS_GetCellString |
Add Styles
VSCROLL, HSCROLL, STATUS, GRIDLINES, ROWSELECT, CELLEDIT, GRIDMODE, COLSIZE, ROWSIZE, WINSIZE, MULTISELECT
SetCell named parameters
txt, data, w, h, bg, fg, type, state, txtal, imgal, fnt
INTEGER: txt = int
COMBOBOX: data = index, txt = hCombo
CHECKBOX: data = 1|0
FORMULA: txt = formula
FLOAT : not implemented
GRAPH : txt = graph definition
GRAPH
| Code: | T(x,y,rotation, color, title) ; set title -1 = center
X,Y(low, high, coordLine, coordBase, color, title) ;set coordinating system
fx(func, precision, color, title) ;create function
gx(start:end,color,title) ; ;create descrete function |
Graph syntax is:
| Code: | | Grp( [T], X, Y, fx1 | gx1, fx2 | gx2, ...) |
Note:
Bad graph definitions will burn CPU and crash application
TYPES
EMPTY, COLHDR, ROWHDR, WINHDR, TEXT, TEXTMULTILINE, INTEGER, FLOAT, FORMULA, GRAPH, HYPERLINK, CHECKBOX, COMBOBOX, EXPANDED, BUTTON, WIDEBUTTON, FORCETEXT
FORMAT
LEFT, CENTER, RIGHT, MIDDLE, BOTTOM, GLOBAL, MASK, XMASK, YMASK
STATES
LOCKED, HIDDEN, REDRAW, ERROR, DIV0, UNDERFLOW, OVERFLOW, RECALC, ERRMASK
Example
| Code: | Gui, +LastFound +Resize +ToolWindow
hwnd := WinExist()
Gui, Add, ComboBox, x0 y0 w245 HWNDhCombo, MyButton||
hCtrl := SS_Add(hwnd, 0, 20, 400, 300, "VSCROLL HSCROLL GRIDMODE CELLEDIT ROWSIZE COLSIZE ROWSELECT")
SS_SetColCount(hCtrl, 2)
SS_SetRowCount(hCtrl, 10)
hCombo := SS_CreateCombo(hCtrl, "WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS")
SS_SetCell(hCtrl, 1, 1, "type=TEXT", "txt=Caption", "bg=0xFF", "fg=0xFFFFFF")
SS_SetCell(hCtrl, 2, 1, "type=TEXT", "txtal=CENTER")
SS_SetCell(hCtrl, 1, 2, "type=TEXT", "txt=Style", "bg=0xFF", "fg=0xFFFFFF")
SS_SetCell(hCtrl, 2, 2, "type=COMBOBOX", "txt=" hCombo, "data=1", "imgal=RIGHT", "txtal=CENTER")
SS_SetCell(hCtrl, 1, 3, "type=TEXT", "txt=Anchor", "bg=0xFF", "fg=0xFFFFFF")
SS_SetCell(hCtrl, 2, 3, "type=BUTTON TEXT", "txt=w0.5 h", "imgal=RIGHT", "txtal=CENTER")
SS_SetCell(hCtrl, 1, 4, "type=TEXT", "txt=Visible", "bg=0xFF", "fg=0xFFFFFF")
SS_SetCell(hCtrl, 2, 4, "type=CHECKBOX", "data=1", "imgal=CENTER")
SS_SetCell(hCtrl, 1, 6, "type=TEXT", "txt=Help", "bg=0xFFFF", "fg=-1")
SS_SetCell(hCtrl, 2, 6, "type=HYPERLINK", "txt=www.autohotkey.com", "w=130", "txtal=CENTER")
SS_SetCell(hCtrl, 1, 8, "type=WIDEBUTTON TEXT", "Txt=Delete &Control", "txtal=CENTER") |
Other Examples
GetCell example
SetGlobal example
Formula example
Graph Example
Original archives (for developers)
Control version 0.0.1.1 (the one wrapped)
Control version 0.0.1.3
Control version 0.0.1.4 _________________

Last edited by majkinetor on Fri Aug 03, 2007 1:07 pm; edited 27 times in total |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Sun Jun 03, 2007 10:33 pm Post subject: |
|
|
Version 0.1
Practicaly everything is possible to set with SetCell function _________________
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Mon Jun 04, 2007 2:30 pm Post subject: |
|
|
No interest/comments for this control...
Project is abandoned then  _________________
 |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 169
|
Posted: Mon Jun 04, 2007 2:49 pm Post subject: |
|
|
Just saw it, seemīs interesting... _________________ John
Inactive - Until AutoHotkey is available for Linux. |
|
| Back to top |
|
 |
elchapin
Joined: 06 Mar 2007 Posts: 58 Location: Columbus, OH, USA
|
Posted: Mon Jun 04, 2007 2:53 pm Post subject: |
|
|
I also think it's very interesting, and I immediately started thinking of possible uses... just curious, what are you planning to do with this?  |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5790
|
Posted: Mon Jun 04, 2007 2:56 pm Post subject: |
|
|
Awesome control!
| majkinetor wrote: | No interest/comments for this control...
Project is abandoned then  |
Uh! Please.. The forum is unable to match your speed, I guess!
Thanks for all the good work!
 |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon Jun 04, 2007 3:58 pm Post subject: |
|
|
No, do keep going. Did you manage to implement import/export yet? Looks interesting too.
Very cool if this control can be fully used in AHK!  |
|
| Back to top |
|
 |
AGU Guest
|
Posted: Mon Jun 04, 2007 4:15 pm Post subject: |
|
|
If you can embed controls within this "spreadsheet control", this could possibly a solution for some kind of continous form I asked a long time ago.
When I wrote my ToDo List app I asked for a possibility like this. If was one of my first questions within this forum.
http://www.autohotkey.com/forum/post-14758.html#14758
Can this control handle this?
______________________
Cheers AGU |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Mon Jun 04, 2007 4:50 pm Post subject: |
|
|
Oh, thank you guys, you are gordgeous...
| Quote: | If you can embed controls within this "spreadsheet control", this
could possibly a solution for some kind of continous form I asked a long time ago. |
Isnt the picture clear ? Isn't the Type clear ?
You can embed only controls available in the Types list, nothing else. So this is not general container.
| Quote: | | Exists an GUI Element that can hold other GUI elements? It should be s.th like a endless form. Do you understand what I mean? |
Of course it exists, its called Tab. You can get "endless form" if you do keep adding controls constantly  _________________
 |
|
| Back to top |
|
 |
AGU Guest
|
Posted: Mon Jun 04, 2007 5:02 pm Post subject: |
|
|
Well it can hold checkbox, text and button.
So it seems to me like a possible solution. Sorry if these next questions sound stupid, but assuming I have a checkbox in a first column, would it be possible to do some kind of action to a text control in a second column when activating/deactivating the checkbox in the first column?
And what about user-action in general. Can these embedded controls be assigned a g-label?
_____________________
Cheers AGU |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Mon Jun 04, 2007 5:06 pm Post subject: |
|
|
SpreadSheat is basicly Excell. I saw in the demo it is possible to do all Excel basic things.
So, the answer is yes. You can uncheck something and influence other cells easily.
Your handler will be called on button click, state change etc, so you can do all that is necessary manualy.
So, SS is not Excell, but it can be wrapped into Excell with some higher API that relies on low level API on this page. _________________
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Mon Jun 04, 2007 5:10 pm Post subject: |
|
|
For instance:
| Code: | SS_SetCell(hCtrl, 1, 1, "type=TEXT", "txt=Caption", "bg=0xFF", "fg=0xFFFFFF")
SS_SetCell(hCtrl, 2, 4, "type=CHECKBOX", "data=1", "imgal=CENTER", "sub=OnChange")
OnChange:
SS_SetCell(hCtrl, 1, 1, "txt=Control is changed")
return |
This little code creates 2 cells one to have check. WHen you check it, it will change cell AA1 (1,1).
Red code is still not implemented. _________________
 |
|
| Back to top |
|
 |
olfen
Joined: 04 Jun 2005 Posts: 99 Location: Stuttgart, Germany
|
Posted: Mon Jun 04, 2007 5:26 pm Post subject: |
|
|
Very impressive! I'm looking forward to using this.
Also thanks for your great work on the other custom controls! |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Mon Jun 04, 2007 7:08 pm Post subject: |
|
|
Just for information: Link to the original with examples
Screenshot of the SprDemo.exe
It can even convert a formula to graphics! And, it can save and import to spr-file. Amazing possibilities for the size.
Would be very cool if we could fully use it with AHK!  |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3622 Location: Belgrade
|
Posted: Tue Jun 05, 2007 12:44 pm Post subject: |
|
|
v0.2
Many new functions added - total count 29.
Acctually, almost everything is implemented but you can not access everything as I didn't find the way to interface some things yet...
The good thing is that SS can even be used for dynamic calculus as it supports Formula type for which you send CALCULATE message
Some examples from the demo code. Fairly trivial to xtend SetCell function to support this:
| Code: | dtCellFloat dt 1.2345
szCellFormula1 db '(AA6+AA7+2)*3',0
szCellFormula2 db 'Sin(Rad(45))',0
szCellGraph db 'Grp(T(-1,0,0,Rgb(0,0,0),"Graph Demo"),X(0,PI()*4,0,1,Rgb(0,0,255),"x-axis"),Y(-1.1,1.1,0,0.5,Rgb(255,0,0),"y-axis"),gx(AJ1:AJ13,Rgb(0,0,0),"Cell values"),fx(Sin(x()),0.1,Rgb(255,0,255),"Sin(x)"),fx(x()^3-x()^2-x(),0.1,Rgb(0,128,0),"x^3-x^2-x"))',0 |
About fonts:
There are 16 slots for user fonts.
U create font by using SS_SetFont(hCtrl, idx, pFont)
U set the font for given cell with SetCell using fnt named parameter which u set to font index you want to use.
One other major thing is missing. SetGlobal.
This sets defaults for everything (row height, widht, colors etc..). This is currently possible to do per cell basis only. _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|