AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 56 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: December 12th, 2007, 10:11 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
This wraps Micas code for cell editing and evls code for row colouring in an easy to use set of functions.

Example (sorry for lack of imagination -_-'):
Code:
Gui, Add, ListView, w250 r8 vLV_Sample gEditLV Grid, Day|Activity
LV_Add("", "Monday")
LV_Add("", "Tuesday")
LV_Add("", "Wednesday", "pre-set value")
LV_Add("", "Thursday")
LV_Add("", "Friday")
LV_Add("", "Saturday")
LV_Add("", "Sunday")
Loop, 3
   LV_ModifyCol(A_Index, "AutoHdr")

LVX_Setup("LV_Sample")
LVX_SetColour(3, 0xce0000, 0xffffff)

LVX_SetColour(2, 0x008000)
LVX_SetColour(5, 0xff8000, 0xffff00)
LVX_SetColour(6, 0xffffff, 0x0000bb)
LVX_SetColour(7, 0xffffff, 0x0000ff)

Gui, Show, , Test
Return

EditLV:
If A_GuiEvent = DoubleClick
   LVX_CellEdit()
Return

GuiClose:
ExitApp


Produces:
Image

Download with instructions

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 10:44 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
Very cool....

It is hard to read what is being typed on my pc though:
Image

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 10:51 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Have you customized your font settings? The edit control is set to match the same dimensions of the cell so you could try increasing font size in your script.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 11:02 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
no font setting changes that i know of. IBM Thinkpad laptop. I made the following changes to my copy of your script:
Code:
...
If i
   {
      Gui, %A_Gui%:Add, Edit, Hwndh ve Hide r1
      h += i := 0
   }
...
Code:
...
   GuiControl, , e, %t%
   GuiControl, Move, e, x%bx% y%by% w%bw% ; h%bh%
   GuiControl, Show, e
...


Last edited by ahklerner on December 12th, 2007, 11:05 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 11:04 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
Font changes mess it up, though.

Code:
Gui, Font, s12
Gui, Add, ListView, w250 r8 vLV_Sample gEditLV Grid, Day|Activity
LV_Add("", "Monday")
LV_Add("", "Tuesday")
LV_Add("", "Wednesday", "pre-set value")
LV_Add("", "Thursday")
LV_Add("", "Friday")
LV_Add("", "Saturday")
LV_Add("", "Sunday")
Loop, 3
   LV_ModifyCol(A_Index, "AutoHdr")
Gui, Font, s20
Gui, add, Text, , Blah
LVX_Setup("LV_Sample")
...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 11:27 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
If i remember correctly about the original code, it may be hard to get it working with RETURN instead clicking.

also, edit appers on wrong place here - 2 rows bellow.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 11:47 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
majkinetor wrote:
If i remember correctly about the original code, it may be hard to get it working with RETURN instead clicking.
You just need a way to break the loop from a different thread when using a hotkey or have the loop check with GetKeyState() and iterate at high frequency. I'll decide on something for next vers.

ahklerner wrote:
Font changes mess it up
majkinetor wrote:
also, edit appers on wrong place here - 2 rows bellow.
Calculating these offsets can be difficult as there are numerous factors that affect the spacing. I'll try fix this too for next time.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 12th, 2007, 11:49 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
thx :)

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 13th, 2007, 7:48 am 
Titan!: s/colour/color/


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2007, 9:06 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
I'll add the archaic spelling as an overload lol..

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2007, 9:24 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Quote:
You just need a way to break the loop from a different thread when using a hotkey or have the loop check with GetKeyState() and iterate at high frequency.

I beleive subclasing is the only real solution. AHK doesn't send return key as event. I recently posted Subclass function and using it u can make it work with Return in few lines of code.


Quote:
Calculating these offsets can be difficult as there are numerous factors that affect the spacing.

Acctually, you can get rectangle of selected item using API, and you can get column width using AHK.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2007, 3:30 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
majkinetor wrote:
Acctually, you can get rectangle of selected item using API, and you can get column width using AHK.
I get both with API, just for consistency. You said the edit control is positioned wrongly on your comp, could you please give a screenshot?

Uploaded 1.03b which introduces hotkeys. When cell editing press Esc to cancel current input or Enter to save it. You can change these hotkeys with the new function of course. I will try to improve on this so edit mode can be invoked via keyboard navigation on the cells (like Excel). Another improvement I want to add is bounding colouring information to rows, so you can enable sorting on the ListView and still retain highlighting for the corresponding cells.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2007, 3:47 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
On 2 totaly different computers:
Image

About ENTER it was not the problem to make it work when edit is active, but to enter edit state with it.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2007, 3:56 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
thank you Titan
here a complet example with 1.03b , change functions when Titan changed
example with add and delete button
http://www.autohotkey.net/~garry/LVX_EX_103b.ahk

Image


Last edited by garry on December 13th, 2007, 4:24 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 13th, 2007, 4:02 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Nice work garry :)

majkinetor could you please try 1.045b and tell me whether the y-alignment has been corrected or not?

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 56 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 22 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