Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[AHK & AHK_L] Forms Framework 0.8


  • Please log in to reply
205 replies to this topic
hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
There seems be some conficts between Attach 1.04 above and ListView control. That is, the listview's DOUBLE click event can't always be triggered normally when I use Attach 1.04+. But 1.04 is ok.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
There is something seriously wrong with ListView and AHK.
Thats all I can say about it after tones of testing with Lexikos included. Even in plain AHK.

Since all versions are in repo, you should perhaps try diffing and see what was changed and how it affects ListView.

The 1.04 is from revision r619.

If you post isolated sample, I can try to see what can be done about it.
Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
I compared 1.04 with 1.07 via Beyond Compare.
It seems due to critical.
My script is too big and need connect to database, so that you can't run it directly. If I have time, I will post a compact and network-independent version.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
Yes, critical setup was changed.
Try omitting critical entirely and see how that works.
It seems there is no single setting there that will work OK for all cases.
Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
When attaching("w h") rebar control inside which I arrange the bands vertically, If I change the width, the bands will become horizontally arranged as the gui is dragged, but the width of bands doesn't changed. Is it normal?

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
Rebar attaches itself. Don't use attach with it. Its similar to attaching the main menu AFAIK.
Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
some problem for unicode AHK_L:
1. panel_add always return 0
2. rebar title can't display correctly. I think it better to parse named params via regexmatch instead of substr because of compatibility of wide char.
;j := InStr( o%A_index%, A_Space ),  prop := SubStr( o%A_index%, 1, j-1), NP_%prop% := SubStr( o%A_index%, j+1, 100) 

RegExMatch(o%A_index%, "^(.+?) (.+)$", v), NP_%v1% := v2


majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
Forms doesn't work with AHK_L. Currently only Toolbar and Attach are guarantied to work.

I tried to port Panel first, but for some reason on some systems it returns 0. On other systems it works.... Some other controls don't support unicode. Even in Unicode environment they will stay ANSI (HiEdit, RaGrid, SpredSheet).

So, I encourage anybody to try porting Panel to AHK_L, since it is most important (also it has the easiest code). It should be noted that, as far as I can see, the code should work unchanged on AHK_L. I consulted Lexikos but Panel works at his place.
Posted Image

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

I consulted Lexikos but Panel works at his place.

The small sample which you asked me to test worked, but in Panel.ahk the following two lines must be changed:
adrGetWindowLong := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), [color=red]"str"[/color], "GetWindowLong[color=red]A"[/color])
adrDefWindowProc := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), [color=red]"str"[/color], "DefWindowProc[color=red]A"[/color])
[color=green]api_suffix := A_IsUnicode ? "W" : "A",  str := A_IsUnicode ? "astr" : "str"[/color]
adrGetWindowLong := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), [color=green]str[/color], "GetWindowLong[color=green]" api_suffix[/color])
adrDefWindowProc := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), [color=green]str[/color], "DefWindowProc[color=green]" api_suffix[/color])
[color=darkgrey]; OR excluding ANSI support:[/color]
adrGetWindowLong := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), [color=green]"astr"[/color], "GetWindowLong[color=green]W"[/color])
adrDefWindowProc := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), [color=green]"astr"[/color], "DefWindowProc[color=green]W"[/color])
With this, at least creating a basic panel works. I haven't tested other functionality. Briefly scrolling over Attach.ahk and Win.ahk, the only obvious issues were:
[*:12osoyz5]the second parameter of GetProcAddress needs to be "astr"; and
[*:12osoyz5]GetModuleFileNameExA (in Win.ahk) needs to be 'W.Scroller.ahk appeared Unicode-friendly (i.e. because none of its DllCalls use strings).

You won't get any performance gain in AutoHotkey_L by looking up those functions in advance (i.e. with GetProcAddress), as it is done automatically wherever possible.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
Yes, I was sending u trivial wndproc because CreateWindow returns nothing on my VISTA @ work system. Thats why I didn't bother to make wndproc cross-AHK.

Ill just make necessary changes and let people to see if it works for them.
Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
I have tried it, it's normal.
Thx Lexikos and majkinetor.

Now the problem is how to make rebar title display unicode charaters correctly. I can't find problem for Rebar_compileBand. But in Rebar_GetBand, WideCharToMultiByte's fifth param should be changed to "ASTR".(For unicode ahk_l, is it neccessary yet?)
int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, [color=red]LPWSTR [/color]lpWideCharStr, int cchWideChar, LPCSTR lpMultiByteStr, int cchMultiByte, [color=red]LPCSTR [/color]lpDefaultChar, PBOOL pfUsedDefaultChar  );

btw:
Rebar_SizeToRect(hRebar, ByRef RECT="~`a?){
what is the default value of RECT? It can't be showed normally in my system, but there is no error while running in anis pagecode.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
I will see about Rebar.

Its just some unlikely to use string. You can see the similar strings around the framework. This is because there is no way to know if user omit parameter or supplied default value. So making default value unlikely you can test against it to see if parameter is omitted ( which is the same as empty string is passed ). The last char is ALT+0160 (pseudospace).

EDIT: About rebar, try with this Insert fun:

Rebar_Insert(hRebar, hCtrl, o1="", o2="", o3="", o4="", o5="", o6="", o7="", o8="", o9=""){
	static RB_INSERTBANDA=0x401, RB_INSERTBANDW=0x40A

	if !(hCtrl+0)
		return A_ThisFunc "> Invalid child handle: " hCtrl

	pos := Rebar_compileBand(BAND, hCtrl, o1, o2, o3, o4, o5, o6, o7, o8, o9)
	if pos is not Integer
		return pos
	
	SendMessage, A_IsUnicode ? RB_INSERTBANDW : RB_INSERTBANDA, pos, &BAND,, ahk_id %hReBar% 
	ifEqual, ErrorLevel, 0, return 0
	return 	NumGet(BAND, 52)   ;return ID
}

Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
It's ok. thx again.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006
I updated Panel, Rebar, Win and Dlg modules to support AHK_L.

Also, Win_Subclass updated so not to trigger DEP protection (thx to Lexikos)


Links are on the 1st page.
Posted Image

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Rebar_GetBand needs an A_IsUnicode check like the one in Dlg_Icon. WideCharToMultiByte should not be called in Unicode builds, since you want the string to remain in Unicode (WideChar) format.

StrPut/StrGet should be easier to use and more portable than WideCharToMultiByte/MultiByteToWideChar as they contain logic to avoid conversion when it isn't necessary. They're built into AutoHotkey_L, and I've uploaded scripted versions for standard AutoHotkey.

But in Rebar_GetBand, WideCharToMultiByte's fifth param should be changed to "ASTR".

"ASTR" must not be used for output parameters in Unicode builds. DllCall allocates only enough memory to contain an ANSI version of your Unicode string; i.e. if you input an empty string, the function receives a 1 byte buffer containing only a null-terminator (zero byte).