Page 1 of 1

[v2] ZeeGrid class

Posted: 02 Apr 2019, 14:01
by kczx3
This is a wrapper class for the awesome ZeeGrid control. This control used to only be available commercially but it appears that the author, David Hillard, released it free of charge in 2015. See his website for documentation and downloads of the Dlls. I also have the Dlls on my GitHub repository for it.

This class is very much just a port of the class I recently posted for the Scintilla control. Since it is completely message based, these are easy to wrap into classes that use the message names as methods.

GitHub Repository - https://github.com/kczx3/AHK-ZeeGrid

There is an included sample as well. Here's a screenshot.
ZeeGrid.png
ZeeGrid.png (25.17 KiB) Viewed 1877 times

Re: [v2] ZeeGrid class

Posted: 02 Apr 2019, 16:14
by robodesign
This is utterly nice! Great work!

Re: [v2] ZeeGrid class

Posted: 02 Apr 2019, 17:02
by guest3456
thumbsup

Re: [v2] ZeeGrid class

Posted: 02 Apr 2019, 20:09
by Flipeador
Hi kczx3, thanks for sharing.
Just say that with SendMessage, in addition to having a significantly worse performance than DllCall, you should be careful with the return value in 32-bit compilations when it can be negative. If you expect a negative value, you must use SendMessage(...)<<32>>32, as indicated in the documentation (making the performance even worse). I have seen that some messages return -1 to indicate an error.

:wave:

Re: [v2] ZeeGrid class

Posted: 02 Apr 2019, 21:25
by freakkk
You are on a roll man! :D

This reminds me a lot of the RaGrid control majkinetor wrapped way back in the day. I can't wait to dig into this one too!

Re: [v2] ZeeGrid class

Posted: 03 Apr 2019, 07:37
by kczx3
Hi there! Thank you for checking it out.
Flipeador wrote:
02 Apr 2019, 20:09
Just say that with SendMessage, in addition to having a significantly worse performance than DllCall, you should be careful with the return value in 32-bit compilations when it can be negative. If you expect a negative value, you must use SendMessage(...)<<32>>32, as indicated in the documentation (making the performance even worse). I have seen that some messages return -1 to indicate an error.
Are you stating that if I use DllCall to invoke SendMessage that it will perform better and I will not have to perform the adjust on the return value?

I've noticed that the control is actually much slower than the standard ListView when added many rows. The control doesn't provide any messages for scrolling but I think I could handle WM_VSCROLL and perform virtualization of the data.

Re: [v2] ZeeGrid class

Posted: 03 Apr 2019, 07:55
by Flipeador
kczx3 wrote:Are you stating that if I use DllCall to invoke SendMessage that it will perform better and I will not have to perform the adjust on the return value?
Exactly.

Code: Select all

DllCall("User32.dll\SendMessageW", "Ptr", this.grid.hwnd, "Ptr", msg, "Ptr", wParam, "Ptr", lParam, "Ptr")

Re: [v2] ZeeGrid class

Posted: 03 Apr 2019, 15:13
by DRocks
wow. very nice. Thank you!

Re: [v2] ZeeGrid class

Posted: 18 Apr 2019, 09:47
by gwarble
very nice looking control and good job on the library, thanks for sharing

any chance you're working on a v1 compatible version?

Re: [v2] ZeeGrid class

Posted: 18 Apr 2019, 10:06
by kczx3
gwarble wrote:
18 Apr 2019, 09:47
very nice looking control and good job on the library, thanks for sharing

any chance you're working on a v1 compatible version?
Negative. I strictly work in v2 for anything new. I never wish to go back to using GUIs the old way.

Re: [v2] ZeeGrid class

Posted: 18 Apr 2019, 11:22
by gwarble
>> any chance you're working on a v1 compatible version? <<
Negative. I strictly work in v2 for anything new. I never wish to go back to using GUIs the old way.
Fair enough... if I take your work and make a v1 compatible version, would you prefer I:
a) share it in this thread
b) share it in a new thread
c) keep it to myself

Re: [v2] ZeeGrid class

Posted: 18 Apr 2019, 15:19
by kczx3
I would recommend you make a new thread.

Re: [v2] ZeeGrid class

Posted: 19 Apr 2019, 02:38
by Helgef
Another nice one kczx3, good job :thumbsup:

Thanks for sharing, cheers.

Re: [v2] ZeeGrid class

Posted: 20 May 2019, 11:27
by burque505
@kczx3, I wonder if you might be able to help me with this error when running the example (Win7 64-bit, various AHK_2 versions:

Code: Select all

---------------------------
ZeeGrid_Sample.ahk
---------------------------
Error:  No object to invoke.

	Line#
	114: Throw Exception(this.__class "::" key "

Unknown property!", -1)
	115: }
	117: Return this.ZeeGridBase[key]
	118: }
	003: {
	003: Return  ExitApp()
	003: }
--->	003: main.OnEvent("close", () => ExitApp())
	005: grid := new ZeeGrid(main, "w600 h400", "", A_PtrSize = 8 ? "ZeeGridx64.dll" : "ZeeGrid.dll")
	006: grid.OnEvent(grid.ZGN_RIGHTCLICK, Func("onRightClick"))
	008: grid.DimGrid(10)
	009: grid.AllocateRows(100)
	010: grid.ShowRowNumbers(true)
	011: grid.EnableRowSizing(true)
	012: grid.SetColumnHeaderHeight(25)

The current thread will exit.
---------------------------
OK   
---------------------------
I've tried it with 2.0 versions from a090 through a103. It won't run at all until a099, and the next few versions throw this error. Thanks!
The only change I made in the example was

Code: Select all

#Include ZeeGrid.ahk
instead of

Code: Select all

#Include <ZeeGrid>
to reflect where ZeeGrid.ahk is (i.e. in the script dir).
Thanks!
Regards,
burque505

Re: [v2] ZeeGrid class

Posted: 20 May 2019, 11:55
by kczx3
Odd. And it does work if you leave it referencing a lib location?

Re: [v2] ZeeGrid class

Posted: 20 May 2019, 12:03
by burque505
I will try that, just a sec.
EDIT: Tried it with ZeeGrid.ahk in a LIB folder below the script dir (and a copy of the DLLs there for good measure), and also with a copy in the LIB folder in the AutoHotkey directory. Odd. I'm sure it's working for everyone else from the posts.
EDIT: And it works fine for me on a Win10 Pro machine using 2.0_a103. :bravo: Thanks for the great script!
Regards,
burque505