AutoHotkey Community

It is currently May 27th, 2012, 10:17 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 118 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
 Post subject:
PostPosted: July 13th, 2010, 2:15 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
majkinetor wrote:
About your questions here is what I think about it: problem with keys could be easily solved by introducing hotkeys (so u could avoid subclassing).


Hmm, good point. It didn't occur to me to go that route, but that might have been easier for me. I wasn't even aware of subclassing until I stumbled across it in your ComboX library, which gave me the idea. In the end the logic is probably the same. , but with a hotkey avoids me having to watch events and figure out which one's I need to respond to.

majkinetor wrote:
About vertical scroll bar, there is a Windows API to know if windows has it, and u can get its dimensions. I think I did something similar in Scroller module.

Thanks for the tip. I knew I'd seen this somewhere before but I haven't made time to go find it. Thanks for giving me a place to look.

majkinetor wrote:
Thanks wtg for your contributions.

And thank you for posting the various libraries you have. Without the SS control and ComboX, I wouldn't be sharing anything.

Btw, I updated the above example slightly. I didn't have #includes for SpreadSheet.ahk and ComboX.ahk, and I corrected a comment or two.

Thanks again.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2010, 6:32 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
In the end the logic is probably the same. , but with a hotkey avoids me having to watch events and figure out which one's I need to respond to.

The difference is that subclassing is more encapsulating, so you could reuse it, you could have multiple levels of it (so module can use it). On the other hand, module shouldn't use hotkey as user could overuse it.

Other important thing is that AHK is not that good with random queue high frequency functions like wndproc. Its best to avoid them if possible.

Quote:
Thanks for the tip. I knew I'd seen this somewhere before but I haven't made time to go find it. Thanks for giving me a place to look.

Dimension is system thing (i.e. SysGet). There is WInAPI to query window for existence of scroll bar.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2010, 8:40 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
I updated the sample program with one other thing I meant to include: enabling movement within the spreadsheet using Tab and Shift-Tab. I found it odd that this doesn't work by default, especially since it seems virtually universal among spreadsheets: tab usually moves the active cell position to the right or ends edit mode, and shift-tab moves left.

It's also useful if you're using the spreadsheet control as an enhanced grid replacement, since using tab to move between columns is intuitive, faster for data entry and much easier to do then moving your hands to the arrow keys.

The only thing I don't like about the solution is that I couldn't find a way programmatically to determine the edit control # that the SS control uses, so the code has to be edited based on the application's context. In this sample, it's Edit1. In the app I'm currently working on, it's Edit7. Any ideas how to improve it?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2010, 9:43 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
As a quick answer, you could select next cell and send ENTER to the control. That way you wont need to know which Edit. Alternatively you could check the detailed info of all Edits and see which one belongs to SS. It will have different parent then AHKGui or some other attribute (style for instance).

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 6th, 2010, 2:28 pm 
Offline

Joined: August 20th, 2010, 4:16 am
Posts: 11
Location: South Korea
(I'm bad English. Please forgive me.)

When I tried to multi-select on SpreadSheet, also I want some change about it like colorize... I'm very awful but hard working. :oops: :cry:

Code:

; sC: start Column / sR: start Row
; eC: end Column / eR:end Row
; #GCC: Get Column Count / #GLC: Get Row Count

ButtonTemp:
SS_GetMultiSel(hCtrl, sR, sC, eC, eR)
Temp(hCtrl, sC, sR, eC, eR)
Return

Temp(hCtrl, sC, sR, eC, eR){
   
   #GCC:=eC-sC+1, #GLC=eR-sR+1
   Add_Col:=eC-sC, Add_Row=eR-sR
   $Col:=sC "|", $Row=sR "|"

   Loop %Add_Col%
      $Col:=$Col sC+A_Index "|"
   Loop %Add_Row%
      $Row:=$Row sR+A_Index "|"
      
   StringTrimRight $Col, $Col, 1 ; get rid of unnecessarily delimeter "|"
   StringTrimRight $Row, $Row, 1

   StringSplit COL, $Col, |
   StringSplit ROW, $Row, |

   Loop % #GCC{
      B_Index:=A_Index
      Loop % #GLC
         SS_SetCell(hCtrl, COL%B_Index%, ROW%A_Index%, "type=", "txt=", "txtal=", "imgal=", "bg=0xFFFFFF") ; hope SS_Function.
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2010, 2:59 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
:)

So, do you need any particular help or just want to report ur success ? I am not sure....

Btw, I see some typos in your code. You have frequent "=" vs ":=" typo/error.
Also, keep in mind that using function names such as "Temp" is not a good idea even while testing. Function name should always represent what function does and nothing more and nothing less (if you can't do that, you need to redesign the function). For instance, in this case "WhitenSSRange" would be good name.

If you hope that there will be SS_ function to change range color, thats not going to happen. The function like that is too specialized to be included in the API. Somebody else might want, as an example, to change foreground color, clear selection, populate it with constants etc....

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2010, 6:38 am 
Offline

Joined: August 20th, 2010, 4:16 am
Posts: 11
Location: South Korea
I'll remember all your advice.

Thank you very much.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 12th, 2010, 9:38 am 
Offline

Joined: April 19th, 2010, 10:22 pm
Posts: 145
Location: Mobile, AL
Majkinetor: I've seen this control around a number of times and really just got into playing with it tonight - it's awesome! I have a lot of things I need to be able to export / display and this is going to make my life much easier, keep up the good work :-)

_________________
Image
Macro Everything
Lucid_Method Index


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 12th, 2011, 5:43 pm 
Offline

Joined: October 15th, 2007, 7:23 pm
Posts: 252
Could someone tell me where to find the source for the StdLib loader and script initializer and other functions (S Structure function) mentioned here:

http://www.autohotkey.net/~majkinetor/_/_.html#_

and in this threads first post.

EDIT:Never mind, I found them as part of the Forms Framework here:

http://www.autohotkey.com/forum/viewtop ... sc&start=0

dmatch


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 1st, 2011, 6:12 am 
Magkinetor, Sorry to bother you with what seems like a newb question but I have been trying to get this SpreadSheet to work and am not having much success. I am running windows 7 64bit with AutoHotkey_L v1.1.05.1

Code:
#Include <Spreadsheet>
 msgbox % SS_Add(....)


with SprSht.dll and the script on the desktop this is my result.

Code:
---------------------------
ss.ahk
---------------------------
Error at line 1086 in #include file "C:\Program Files (x86)\AutoHotkey\Lib\Spreadsheet.ahk".

Line Text: params = "colhdr rowhdr winhdr cell"
Error: Duplicate declaration.

The program will exit.
---------------------------
OK   
---------------------------



What am I missing?

Thanks for any assistance you can provide.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2012, 5:32 pm 
Offline

Joined: February 6th, 2007, 12:30 am
Posts: 142
Location: Michigan
I get the same duplicate error message when running test.

_________________
http://www.panofish.net


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2012, 11:26 pm 
What happens if you change it like so
Code:
params := "colhdr rowhdr winhdr cell"
? Or it might not work with Unicode at all ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2012, 4:11 pm 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
I believe the problem is actually 3 lines earlier where params is declared as a local.

Code:
   local p, N, s, params, himgal, htxtal
   static SPRM_SETGLOBAL=0x489      ; wParam=0, lParam=pointer to GLOBAL struct.
   static LEFT=0x10, CENTER=0x20, RIGHT=0x30, MIDDLE=0x40, BOTTOM=0x80, GLOBAL=0xF0, MASK=0xF0, XMASK=0x30, YMASK=0xC0               ;formats
   static params = "colhdr rowhdr winhdr cell"

Just remove that reference on line 1083 and the error should go away.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 118 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8

All times are UTC [ DST ]


Who is online

Users browsing this forum: specter333, XX0 and 25 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group