ActiveX too long for gui Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Mipha
Posts: 77
Joined: 27 Jul 2018, 17:08

ActiveX too long for gui

19 Aug 2018, 16:08

Code: Select all

#Singleinstance force
html := "
(
<!DOCTYPE html>
 <html>
  <head>
   <style type=text/css>
    html {border-style: solid; height: 100%;}
    body {background:#AAAAAA; height: 100%;}
   </style>
  </head>
  <body>
  </body>
 </html>
)"

Gui,Margin,0,0
Gui, Add, ActiveX, W500 H500 x0 y0 vdoc, HTMLFile
doc.write(html)
gui, show
return
When I run this code. A gui with a border appears that goes below the screen. How can I fix this so the entire border gets put inside the gui?
Mipha
Posts: 77
Joined: 27 Jul 2018, 17:08

Re: ActiveX too long for gui

20 Aug 2018, 18:44

Its been 2 days... Can someone maybe at least point me towards a thread where people have similar problems so I can read it and maybe get some insight? Or maybe tell me how I should search this problem. As in what words to use in the search (because I'm really bad at that)
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: ActiveX too long for gui

21 Aug 2018, 15:55

One guess: use vh - the viewport's height -, which is a relative measurement instead of %, which is an absolute measurement.
my scripts
Mipha
Posts: 77
Joined: 27 Jul 2018, 17:08

Re: ActiveX too long for gui

22 Aug 2018, 18:30

A_AhkUser wrote:One guess: use vh - the viewport's height -, which is a relative measurement instead of %, which is an absolute measurement.
Hmm. I can't seem to get vh and vw working in AHK. Can you maybe give an example of how to use it?
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: ActiveX too long for gui

22 Aug 2018, 19:16

Mipha wrote:Hmm. I can't seem to get vh and vw working in AHK. Can you maybe give an example of how to use it?
Specify about:<!doctype html><meta http-equiv="X-UA-Compatible" content="IE=edge"> for the name of the ActiveX component:

Code: Select all

html =
(LTrim Join
<!DOCTYPE html>
<html>
<head>
	<style type=text/css>
	body {
		margin: 0;
	}
	.test {
		width: 100vw;
		height: 100vh;
		background-color: black;
		border-radius: 71px;
	}
	</style>
</head>
<body>
<button class='test'></button>
</body>
</html>
)
GUI, +Resize
GUI, Margin, 0, 0
GUI, Add, ActiveX, W400 H300 x0 y0 vHTMLDoc, about:<!doctype html><meta http-equiv="X-UA-Compatible" content="IE=edge">
HTMLDoc.document.write(html), HTMLDoc.document.close()
GUI, Show, AutoSize
return

GUISize:
	GuiControl, Move, HTMLDoc, % Format("w{:1} h{:2}", A_GuiWidth, A_GuiHeight)
return

GUIClose:
ExitApp
Hope this helps.
my scripts
Mipha
Posts: 77
Joined: 27 Jul 2018, 17:08

Re: ActiveX too long for gui

22 Aug 2018, 19:48

A_AhkUser wrote:
Mipha wrote:Hmm. I can't seem to get vh and vw working in AHK. Can you maybe give an example of how to use it?
Specify about:<!doctype html><meta http-equiv="X-UA-Compatible" content="IE=edge"> for the name of the ActiveX component:

Code: Select all

html =
(LTrim Join
<!DOCTYPE html>
<html>
<head>
	<style type=text/css>
	body {
		margin: 0;
	}
	.test {
		width: 100vw;
		height: 100vh;
		background-color: black;
		border-radius: 71px;
	}
	</style>
</head>
<body>
<button class='test'></button>
</body>
</html>
)
GUI, +Resize
GUI, Margin, 0, 0
GUI, Add, ActiveX, W400 H300 x0 y0 vHTMLDoc, about:<!doctype html><meta http-equiv="X-UA-Compatible" content="IE=edge">
HTMLDoc.document.write(html), HTMLDoc.document.close()
GUI, Show, AutoSize
return

GUISize:
	GuiControl, Move, HTMLDoc, % Format("w{:1} h{:2}", A_GuiWidth, A_GuiHeight)
return

GUIClose:
ExitApp
Hope this helps.
I could not get your copy to work at first but when I added this part

Code: Select all

GUI, Add, ActiveX, W400 H300 x0 y0 vHTMLDoc, about:<!doctype html><meta http-equiv="X-UA-Compatible" content="IE=edge">
HTMLDoc.document.write(html), HTMLDoc.document.close()
instead of my version

Code: Select all

Gui, Add, ActiveX, W500 H500 x0 y0 vdoc, HTMLFile
doc.write(html)
it did work. The problem with this is the way how different your version is from mine. I do not plan on using the solution but thanks for the help anyways.

I do have a question though. Could I potentially solve this issue using a gui-wide table with a border? Or something else screenwide with a border? Because I noticed that the border extends outwards so when I add it to a 400W gui, the border makes it 402W or something. So if I could point the borders inwards instead of outwards that would solve the issue.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: ActiveX too long for gui

22 Aug 2018, 20:01

- Perhaps AdjustWindowRectEx will prove helpful, see here for info/examples:
slightly-improved dialogs - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 37&t=45220
- You start with the size of the client area that you want, calculate the required window area, and tell that to the Gui command.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: ActiveX too long for gui  Topic is solved

23 Aug 2018, 15:18

As for me, its definitely not an ActiveX control-related size calculation problem.
What reinforces my belief in this is that an attempt to run the html source from the OP in firefox, for example, make you end up with the same 'issue'.
If it is question to keep the html source and force the GUI control to fit its size, I can't think of any solution.

I would assume that the aim here is to create some kind of frame encompassing the page, correct me if I'm wrong Mipha. If so, it might be possible to do this using a table element but div elements are the usual candidates - they are more flexible. The easiest way I can think of is to use four fixed div. An element positioned in a fixed position is positioned relative to the browser window; that is, it always remains in the same place, even if the page scrolls. With this technique, you can use both left: 0; right: 0; and top: 0; bottom: 0; in place of width: 100%; and height: 100%; respectively:

Code: Select all

#NoEnv
#SingleInstance force
#Warn

html =
(
<!DOCTYPE html>
<html>
<head>
<style type=text/css>
div {
	position: fixed;
	background: red;
}
.v {
	top: 0;
	bottom: 0;
	width: 2px;
}
.h {
	left: 0;
	right: 0;
	height: 2px;
}
#left {
	left: 0;
}
#right {
	right: 0;
}
#top {
	top: 0;
}
#bottom {
	bottom: 0;
}
</style>
</head>
<body>
<div class="v" id="left"></div><div class="v" id="right"></div><div class="h" id="top"></div><div class="h" id="bottom"></div>
</body>
</html>
)

Gui,Margin, 0, 0
Gui, Add, ActiveX, W500 H500 vdoc, HTMLFile
doc.write(html), doc.close()
GUI, Show, AutoSize
return
Css is definitely not my cup of tea - it might exist a nicer way to do this. Otherwise, both the before: and after: pseudo-property or the outline property could be helpful.

Hope this helps.
my scripts
Mipha
Posts: 77
Joined: 27 Jul 2018, 17:08

Re: ActiveX too long for gui

23 Aug 2018, 18:25

A_AhkUser wrote:As for me, its definitely not an ActiveX control-related size calculation problem.
What reinforces my belief in this is that an attempt to run the html source from the OP in firefox, for example, make you end up with the same 'issue'.
If it is question to keep the html source and force the GUI control to fit its size, I can't think of any solution.

I would assume that the aim here is to create some kind of frame encompassing the page, correct me if I'm wrong Mipha. If so, it might be possible to do this using a table element but div elements are the usual candidates - they are more flexible. The easiest way I can think of is to use four fixed div. An element positioned in a fixed position is positioned relative to the browser window; that is, it always remains in the same place, even if the page scrolls. With this technique, you can use both left: 0; right: 0; and top: 0; bottom: 0; in place of width: 100%; and height: 100%; respectively:

Code: Select all

#NoEnv
#SingleInstance force
#Warn

html =
(
<!DOCTYPE html>
<html>
<head>
<style type=text/css>
div {
	position: fixed;
	background: red;
}
.v {
	top: 0;
	bottom: 0;
	width: 2px;
}
.h {
	left: 0;
	right: 0;
	height: 2px;
}
#left {
	left: 0;
}
#right {
	right: 0;
}
#top {
	top: 0;
}
#bottom {
	bottom: 0;
}
</style>
</head>
<body>
<div class="v" id="left"></div><div class="v" id="right"></div><div class="h" id="top"></div><div class="h" id="bottom"></div>
</body>
</html>
)

Gui,Margin, 0, 0
Gui, Add, ActiveX, W500 H500 vdoc, HTMLFile
doc.write(html), doc.close()
GUI, Show, AutoSize
return
Css is definitely not my cup of tea - it might exist a nicer way to do this. Otherwise, both the before: and after: pseudo-property or the outline property could be helpful.

Hope this helps.
This looks great. I'll experiment with it. See what I can do but for now. Thank you for your help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 155 guests