Thx,
I was not sure if I would need to think about DPIscale. Thinking hurts DPI also hurts
edit: i noticed your edit
DPIscale is a problem then, is it a problem for all my CustomBoxes I wonder ...
I should test, or blindly put in -DPIscale and hope. I am not used to swich back and forth DPI
CustomBoxes: a collection of helper functions
Re: CustomBoxes: a collection of helper functions
Your latest pic shows the size of browser matches the size of buttons, that's good.
I have hard-coded the drawing in javascript, which also seems to work as expected.
I have hard-coded the drawing in javascript, which also seems to work as expected.
Re: CustomBoxes: a collection of helper functions
and this looks like windows 7 rather than windows 10
Re: CustomBoxes: a collection of helper functions
@DRocks, @wolf_II, I am indeed using Win7
Re: CustomBoxes: a collection of helper functions
Try this:
- No more mass-writing of HTML-code via plugging into Format(Template, ...)
- Now using static Html, loaded ONCE into the browser.
- AHK-buttons send clicks to browser buttons.
- Browser buttons are off-screen (to see them, I used scrolling via Ctrl + Wheel).
- On my system, resizing is working.
- Uses a html file and a java-script file
Cube Meshes.ahk
Cube Meshes.html
Cube Meshes.js
Re: CustomBoxes: a collection of helper functions
@wolf_II, that's impressive!
Everything works for me on Win7 64-bit, AHK_L 1.1.30.01 64-bit, 125% scaling.
Regards,
burque505
Everything works for me on Win7 64-bit, AHK_L 1.1.30.01 64-bit, 125% scaling.
Regards,
burque505
Re: CustomBoxes: a collection of helper functions
Thx for feedback
Re: CustomBoxes: a collection of helper functions
Here is the new member of the family: HtmlBox.ahk
But the magic lies in the test script.
There I use WebBrowser and HTMLWindow2 object.
(using javascript variables and functions from AHK)
Here is an example which manipulates the background picture in canvas:
But the magic lies in the test script.
There I use WebBrowser and HTMLWindow2 object.
(using javascript variables and functions from AHK)
HtmlBox.ahk
Here is an example which manipulates the background picture in canvas:
Test.HtmlBox.ahk
HtmlBox.html
JScript.js
Re: CustomBoxes: a collection of helper functions
@wolf_II, that's great, thank you! Just for fun, I mangled the test script to show - well - the horizon from horseback?
(I changed the file paths in it, "HTML Box.html" is in the same folder as the main script, and my #Include has HTML Box.ahk in the same folder also. I might have to remove this GIF, it's making me dizzy Edit: Done!
(I changed the file paths in it, "HTML Box.html" is in the same folder as the main script, and my #Include has HTML Box.ahk in the same folder also.
Spoiler
PS:
Last edited by burque505 on 29 Mar 2019, 07:31, edited 1 time in total.
Re: CustomBoxes: a collection of helper functions
see code below
Last edited by wolf_II on 29 Mar 2019, 08:01, edited 1 time in total.
Re: CustomBoxes: a collection of helper functions
Nice LV Box wolf.
Re: CustomBoxes: a collection of helper functions
TV_Show
Code: Select all
#NoEnv
; make points
p0 := {x: 100, y: 100}
p1 := {x: 500, y: 500}
p2 := {x: 500, y: 100}
p3 := {x: 100, y: 500}
; make Points array with them
Points := [p0, p1, p2, p3]
TV_Show(Points, "Points",, 50, 50, 200)
loop 100 {
p0.x ++, p0.y --, p1.x += 2, p1.y -= 3
TV_Show(Points, "Points", False)
leep 50 ; ~5 sec total ime
}
MsgBox, done
ExitApp ; end of auto-execute section
;-------------------------------------------------------------------------------
TV_Show( ByRef Obj ; object to show
;-------------------------------------------------------------------------------
, Name := "" ; name of the object
, WaitEsc := True ; wait for {Esc}-key ?
, x := "", y := "" ; x,y position of the GUI
, w := "", h := "" ) ; width/height of the GUI
;---------------------------------------------------------------------------
{
local ; protect superglobal variables
static hTV := 0, _X := 0, _Y := 0, _W := 240, _H := 400
_X := (x = "" ? _X : x), _W := (w = "" ? _W : w)
_Y := (y = "" ? _Y : y), _H := (h = "" ? _H : h)
; create GUI
Saved := A_DefaultGui
if hTV
Gui, TV: Default
else {
Gui, TV: New, HWNDhTV, Tree
Gui, +Resize -MinimizeBox -MaximizeBox
Gui, Margin, 0, 0
Gui, Add, TreeView, w%_W% h%_H%
}
; populate TreeView
GuiControl, -Redraw, SysTreeView321
TV_Delete()
if _isCircular(Obj)
TV_Add("Circular reference", TV_Add(Name,, "Expand"))
else ; recurse
_PopulateTree(Obj, Name)
GuiControl, +Redraw, SysTreeView321
; main loop
_TV_MOVE(hTV, _X, _Y, "")
Gui, Show, x%_X% y%_Y%
Gui, %Saved%: Default
if WaitEsc
KeyWait, Escape, D
return ; end of function
TVGuiSize:
GuiControl, Move, SysTreeView321, w%A_GuiWidth% h%A_GuiHeight%
return
}
;-------------------------------------------------------------------------------
_PopulateTree(ByRef Obj, Name, ParentID := 0, Key := "") { ; populate the tree
;-------------------------------------------------------------------------------
local
static Value := ""
Root := TV_Add(Key ? Key : Name, ParentID, "Expand")
for Key, Value in Obj
if IsObject(Value)
_PopulateTree(Value, "Value", Root, Key)
else
TV_Add(Value, TV_Add(Key, Root, "Expand"))
}
;-------------------------------------------------------------------------------
_isCircular(Obj, Objs := 0, dummy := 0) { ; return true if Obj is circular
;-------------------------------------------------------------------------------
local
if not IsObject(Objs)
Objs := []
for each, Value in Obj
if IsObject(Value)
if Objs[&Value] or _isCircular(Value, Objs, Objs[&Value] := True)
return True
return False
}
;-------------------------------------------------------------------------------
_TV_MOVE(wP, ByRef lP, ByRef msg, hWnd) { ; fires when window's position changes
;-------------------------------------------------------------------------------
local
static hGui := OnMessage(0x3, "_TV_MOVE"), _WinX := 0, _WinY := 0
if (hWnd = "") {
if (hGui = "_TV_MOVE" || _WinX = "")
hGui := wP, _WinX := lP, _WinY := msg
else ; send back static vars
lP := _WinX, msg := _WinY
return ; private call
}
if (hWnd != hGui)
return ; only monitor hGui
if not (wP = 1 || wP = 2) ; isMin or isMax
WinGetPos, _WinX, _WinY,,, ahk_id %hGui%
}
Last edited by wolf_II on 29 Mar 2019, 14:12, edited 14 times in total.
Re: CustomBoxes: a collection of helper functions
LV_Show
Code: Select all
#NoEnv
; make points
p0 := {x: 100, y: 100}
p1 := {x: 500, y: 500}
p2 := {x: 500, y: 100}
p3 := {x: 100, y: 500}
; make Points array with them
Points := [p0, p1, p2, p3]
Options := [["#", "Center"], ["x"], ["y"]]
LV_Show(Points, Options,, 50, 50, 100, 100)
loop 100 {
p0.x ++, p0.y --, p1.x += 2, p1.y -= 3
LV_Show(Points, Options, False)
leep 50 ; ~5 sec total ime
}
MsgBox, done
ExitApp ; end of auto-execute section
;-------------------------------------------------------------------------------
LV_Show( ByRef Table ; table to show
;-------------------------------------------------------------------------------
, ByRef Options ; options for columns
, WaitEsc := True ; wait for {Esc}-key ?
, x := "", y := "" ; x,y position of the GUI
, w := "", h := "" ) ; width/height of the GUI
;---------------------------------------------------------------------------
; Note: The function automatically adds a final column which makes adjusting
; the width of the "real" last column independent of the GUI's width.
{
local ; protect superglobal variables
static hLV := 0, _X := 0, _Y := 0, _W := 400, _H := 240
_X := (x = "" ? _X : x), _W := (w = "" ? _W : w)
_Y := (y = "" ? _Y : y), _H := (h = "" ? _H : h)
; headers (column #1)
Headers := "", Col := []
for each, Column in Options
Headers .= (Col[A_Index] := Column[1]) "|"
; create GUI
Saved := A_DefaultGui
if hLV
Gui, LV: Default
else {
Gui, LV: New, HWNDhLV, Table
Gui, +Resize -MinimizeBox -MaximizeBox
Gui, Margin, 0, 0
Gui, Add, ListView, w%_W% h%_H% Grid, % Headers A_Space
}
; populate ListView
GuiControl, -Redraw, SysListView321
LV_Delete()
for each, Row in Table {
Private := []
if IsObject(Row)
loop % Options.Length() - 1
Private.Push(Row[Col[A_Index + 1]])
else
Private.Push(each, Row)
LV_Add("", A_Index, Private*)
}
; options (column #2)
for each, Column in Options
LV_ModifyCol(A_Index, "AutoHdr " Column[2])
LV_ModifyCol(LV_GetCount("Col"), 0) ; hide last column
GuiControl, +Redraw, SysListView321
; main loop
_LV_MOVE(hLV, _X, _Y, "")
Gui, Show, x%_X% y%_Y%
Gui, %Saved%: Default
if WaitEsc
KeyWait, Escape, D
return ; end of function
LVGuiSize:
GuiControl, Move, SysListView321, w%A_GuiWidth% h%A_GuiHeight%
return
}
;-------------------------------------------------------------------------------
_LV_MOVE(wP, ByRef lP, ByRef msg, hWnd) { ; fires when window's position changes
;-------------------------------------------------------------------------------
local
static hGui := OnMessage(0x3, "_LV_MOVE"), _WinX := 0, _WinY := 0
if (hWnd = "") {
if (hGui = "_LV_MOVE" || _WinX = "")
hGui := wP, _WinX := lP, _WinY := msg
else ; send back static vars
lP := _WinX, msg := _WinY
return ; private call
}
if (hWnd != hGui)
return ; only monitor hGui
if not (wP = 1 || wP = 2) ; isMin or isMax
WinGetPos, _WinX, _WinY,,, ahk_id %hGui%
}
Last edited by wolf_II on 29 Mar 2019, 13:58, edited 6 times in total.
Re: CustomBoxes: a collection of helper functions
TreeView is also very nice.
Is it me or when adding a litteral string between quotes, it doesn't show up?
Is it me or when adding a litteral string between quotes, it doesn't show up?
Code: Select all
p0 := {x: 100, y: 100}
p1 := {x: 500, y: 500}
p2 := {x: 500, y: 100}
p3 := {x: 100, y: 500}
p4 := {x: "Allo", y: "hi"}
Re: CustomBoxes: a collection of helper functions
Did you put Points := [p0, p1, p2, p3, p4] ?
Thanks for the compliment!
Edit: I commented the examples.
Thanks for the compliment!
Edit: I commented the examples.
Re: CustomBoxes: a collection of helper functions
Hmm right on. My bad. No I missed that obvious part. Sry and thanks
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 79 guests