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
majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Thx Lexikos. I forgot to change this function. Updated Rebar version is in the repository now.
Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
1. Rebar_SetBand also should be changed as follow because named parameter "T" may be used.
static RB_SETBANDINFO = A_IsUnicode ? 0x40B : 0x406
SendMessage, RB_SETBANDINFO, WhichBand, &BAND, ,ahk_id %hRebar%

2.
Splitter_Add2Form(HParent, Txt, Opt){
	static parse = "Form_Parse"
lack of : ?

3. Splitter: In AHK_L, seprated bar can't be dragged.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

Rebar_SetBand also should be changed as follow because named parameter "T" may be used.

Will be fixed.

lack of : ?

= equals to := when used with static.

Splitter: In AHK_L, seprated bar can't be dragged.

I didn't work with Splitter in AHKL yet. Ill check out when I find time whats the problem

Thx for reports.
Posted Image

guest3456
  • Guests
  • Last active:
  • Joined: --
DockA bug:

when a window is docked to an ahk gui, and you un-dock via "-" param, the window that was docked is missing from the taskbar and doesnt really update itself back to Windows.

fix, to return its parent back. i dont know what would happen if you prematurely closed your ahk window and didnt undock onexit. and i also don't know if this is the best way to do it or not:

DockA(HHost="", HClient="", DockDef="") {
	DockA_(HHost+0, HClient+0, DockDef, "")
}

DockA_(HHost, HClient, DockDef, Hwnd) {
	static
	
	if HClient && (DockDef != 3)
	{
		If !init 
			init := OnMessage(3, A_ThisFunc) ; WM_MOVE 	;adrSetWindowPos := DllCall("GetProcAddress", "uint", DllCall("GetModuleHandle", "str", "user32"), "str", "SetWindowPos")

		HClient += 0, HHost += 0
		if (DockDef="-") 
			if InStr(%HHost%, HClient) {
				StringReplace, %HHost%, %HHost%, %A_Space%%HClient%
				[color=red]DllCall("SetWindowLong", "uint", HClient, "int", -8, "uint", %HClient%_oldparent)[/color]
				return
			} else return

	   if (DockDef = "") {		;pin
	      WinGetPos hX, hY,,, ahk_id %HHost%
	      WinGetPos cX, cY,,, ahk_id %HClient% 
	      DockDef := "x(0,0," cX - hX ")  y(0,0," cY - hY ")"
	   } 

		%HClient%_x1 := %HClient%_x2 := %HClient%_y1 := %HClient%_y2 := %HClient%_h1 := %HClient%_w1 := %HClient%_x3 := %HClient%_y3 := %HClient%_h2 := %HClient%_w2 := ""
		loop, parse, DockDef, %A_Space%%A_Tab%
		{
			ifEqual, A_LoopField,,continue

			t := A_LoopField, c := SubStr(t,1,1), t := SubStr(t,3,-1)
			StringReplace, t, t,`,,|,UseErrorLevel
			t .= !ErrorLevel ? "||" : (ErrorLevel=1 ? "|" : "")
			loop, parse, t,|,%A_Space%%A_Tab% 
				%HClient%_%c%%A_Index% := A_LoopField ? A_LoopField : 0			
		}
		[color=red]%HClient%_oldparent := [/color]DllCall("SetWindowLong", "uint", HClient, "int", -8, "uint", hHost)
		return %HHost% .= (%HHost% = "" ? " " : "") HClient " "
	} 
	
	ifEqual, HHost, 0,SetEnv, HHost, %Hwnd%
	ifEqual, %HHost%,,return

	oldDelay := A_WinDelay, oldCritical := A_IsCritical
	SetWinDelay, -1
	critical 100
	
	WinGetPos hX, hY, hW, hH, ahk_id %HHost%
	loop, parse, %HHost%, %A_Space%
	{ 		
		ifEqual, A_LoopField,,continue
		else j := A_LoopField
		WinGetPos cX, cY, cW, cH, ahk_id %j% 
		w := %j%_w1*hW + %j%_w2,  h := %j%_h1*hH + %j%_h2
		, x := hX + %j%_x1*hW + %j%_x2*(w ? w : cW) + %j%_x3
		, y := hY + %j%_y1*hH + %j%_y2*(h ? h : cH) + %j%_y3
		WinMove ahk_id %j%,,x,y, w ? w : "" ,h ? h : ""			;	DllCall(adrSetWindowPos, "uint", hwnd, "uint", 0, "uint", x ? x : cX, "uint", y ? y : cY, "uint", w ? w : cW, 

"uint", h ? h :cH, "uint", 1044) ;4 | 0x10 | 0x400 
	}
	SetWinDelay, %oldDelay%
	critical %oldCritical%
}


guest3456
  • Guests
  • Last active:
  • Joined: --
i also think that DockA should somehow auto-snap the client to the host upon the first docking. its not doing it on my winxp system, i'm having to do this:

      DockA(MainGuiHwnd, clienthwnd, "x(1) y()")
      SendMessage, 3 ,,,, ahk_id%MainGuiHwnd%


majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
I am not particularly concerned because dock is generally used with tool windows and you already found quick solution. I will look into this in the future anyway.

About auto snap, it should do that. Could you provide the sample ? In given Forms sample it obviously pins at the start unless I don't understand your problem correctly .


Thanks for your input.
Posted Image

guest3456
  • Guests
  • Last active:
  • Joined: --

About auto snap, it should do that. Could you provide the sample ? In given Forms sample it obviously pins at the start unless I don't understand your problem correctly .


here you go, for me it doesn't auto snap on winxp.

#include ../lib/DockA.ahk

Gui, Add, Text,, Mouse over a window and press f2 to attach
Gui, Show, h100 , mygui
Gui, +LastFoundExist
MainGuiHwnd := WinExist()

return         ;// end of autoexec


F2::
   MouseGetPos,,, win
   DockA(MainGuiHwnd, win, "x(1) y()")
   ;SendMessage, 3,,,,ahk_id%MainGuiHwnd%     ;// send WM_MOVE
return

i have to manually send the WM_MOVE from previous post to invoke the DockA OnMessage code to get an initial snap

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
In line:

72:		[color=red]return [/color]%HHost% .= (%HHost% = "" ? " " : "") HClient " "

just delete return word.
That should fix it.

Also, I incorporated your other change as I find it OK.


Thanks.
Posted Image

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
*** v0.7 ***

* Lots of small changes and reported bug fixes in many modules.

* All modules work with AHK_L now except RichEdit and dlls which don't support unicode by design. QHTM supports it but all 3hd party software will be removed in the future.
Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007

*** v0.7 ***

* Lots of small changes and reported bug fixes in many modules.

* All modules work with AHK_L now except RichEdit and dlls which don't support unicode by design. QHTM supports it but all 3hd party software will be removed in the future.


Would RichEdit be removed too?
Is it possible to make it be compatible with unicode AHK_L?

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
No, RichEdit doesn't require 3td party dll. Only non-Unicode stuff will be removed.
I will try to port it to unicode. So far I had problems to do that.
If anybody wants to look into it, I didn't succeed to make RE_SetText work.

Modules that will be removed will still be present as separate downloads.
Posted Image

DoubleA
  • Members
  • 15 posts
  • Last active: Nov 11 2010 08:09 AM
  • Joined: 09 May 2009
Dlg_Save parameter DefaultExt always truncate 1 character on the right.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Can't confirm.
I used Dlg\_Test to check it out.

With line:
Dlg_Save(hGui, "Select several files", "All Files (*.*)|Audio (*.wav; *.mp2; *.mp3)|Documents (*.txt)", "", "c:\", "MyExt")

The output is:
C:\test.MyExt

Tested in AHK(_L)
Posted Image

Gauss
  • Members
  • 203 posts
  • Last active: Jan 27 2012 12:49 PM
  • Joined: 10 Sep 2009
Hello majkinetor,

I read the documentation but I can't figure out how to make the buttons icons bigger/smaller?, I tried "Toolbar_SetBitmapSize" but no luck.


Is it possible you demonstrate that using my code?

I appreciate that

Gui 1: +LastFound -MiniMizeBox
WIN_ID := WinExist()

Gui, color, FDF5E6
Gui, Add, text, x0 y0

CreateImageList()

hToolbarAdd := Toolbar_Add(WIN_ID, "ToolbarHandler", "Flat", hIL, "x15 y15 w570 h100")

Toolbar_Insert(hToolbarAdd, "Camel, 131")
Toolbar_Insert(hToolbarAdd, "Exit,18")

Toolbar_SetButtonSize(hToolbarAdd, 80, 80)	;w h

Gui 1: Show, w500 h110, Toolbar
RETURN

ToolbarHandler(hCtrl, pEvent, pTxt, pPos, pId) {
	global
	; tooltip, %pEvent%
	IF (pEvent = "click") {
		Gui 1: Destroy
		GoSub %pTxt%
		}
		ELSE RETURN
	}

CreateImageList() {
	global
	hIL := IL_Create(80, 0, 1) ;create imagelist
	Loop 250
		IL_Add(hIL, "Shell32.dll", A_Index) ;load icons from our dll
	}
; #Include Toolbar.ahk


majkinetor!
  • Guests
  • Last active:
  • Joined: --
To use arbitrary icon size you need to use ImageList module. AHK only supports two icon sizes - 16 & 32.

ImageList APIs are just few functions and you can either find them on the forum or do DllCalls yourself. I have them included in some of my work around.