[solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

[solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

26 Dec 2015, 19:34

When I run script below, buttons don't have rounded corners [bad], but when I display the same page in browser they have rounded corners [good]. In other words, border-radius property doesn't have effect when ran from AHK script..
Why is this happening? What am I doing wrong?
Tested on Windows 10; Microsoft Edge 25, Internet Explorer 11, Mozilla Firefox 43

Code: Select all

Gui, Add, ActiveX, x2 y2 w300 h200 vwb, Shell.Explorer
wb.Navigate("https://dl.dropboxusercontent.com/s/3ixr125y4w6eyva/border-radius test.html")
While, (wb.ReadyState != 4)                                        ; wait until READYSTATE_COMPLETE
	Sleep, 100
Gui, Show, w302 h202, border-radius test
Return
Image
Last edited by Learning one on 20 Jan 2016, 02:51, edited 4 times in total.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: ActiveX, Shell.Explorer, style, border-radius

26 Dec 2015, 20:29

The WebBrowser control operates in IE7 mode by default. This can only be overridden within the document (with a X-UA-Compatible meta-tag) or via the registry based on your process name. Search the forum for FixIE or FEATURE_BROWSER_EMULATION.
User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: ActiveX, Shell.Explorer, style, border-radius

26 Dec 2015, 20:39

rawr. fear me.
*poke*
Is it December 21, 2012 yet?
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: ActiveX, Shell.Explorer, style, border-radius

27 Dec 2015, 00:21

lexikos wrote:This can only be overridden within the document (with a X-UA-Compatible meta-tag) ...

Code: Select all

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
. . .
Just add the meta tag in your document if you don't want to tinker with the registry.
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: ActiveX, Shell.Explorer, style, border-radius

27 Dec 2015, 14:42

Lexikos, TidbiT, Coco,
thank you for fast and professional help. I'll use X-UA-Compatible meta-tag; <meta http-equiv="X-UA-Compatible" content="IE=Edge">
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: ActiveX: Shell.Explorer vs HtmlFile, border-radius

18 Jan 2016, 06:03

I'll have to reopen this topic.

When I use Shell.Explorer and navigate to a page which has the following meta-tag; <meta http-equiv="X-UA-Compatible" content="IE=Edge">, everything is fine - a see rounded borders;

Code: Select all

Gui, Add, ActiveX, x2 y2 w300 h200 vwb, Shell.Explorer
wb.Navigate("https://dl.dropboxusercontent.com/s/06nj95ifdvqu6jc/border-radius test X-UA-Compatible.html")
While, (wb.ReadyState != 4)                                        ; wait until READYSTATE_COMPLETE
	Sleep, 100
Gui, Show, w302 h202, border-radius test
Return

GuiClose:
ExitApp
But if I use HtmlFile instead of Shell.Explorer and write exactly the same html (with <meta http-equiv="X-UA-Compatible" content="IE=Edge"> meta tag), I will not see rounded borders;

Code: Select all

html = 
(`%
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><meta http-equiv="X-UA-Compatible" content="IE=Edge"></head>

<style>
.button {
padding: 0px;
text-align: center;
font-size: 11px;
margin: 2px;
cursor: pointer;
position: fixed;
border-radius: 5px;
background-color: white; color: black; border: 2px solid #4CAF50;
}
.button:hover {
background-color: #4CAF50;
color: white;
}
.Normal {
width: 98px;
height: 48px;
}
.Small {
width: 48px;
height: 48px;
}
</style><title>border-radius test</title>

</head>
<body>
<button class="button Normal" style="top: 0px; left: 0px;">Cut</button>
<button class="button Normal" style="top: 50px; left: 0px;">Copy</button>
<button class="button Normal" style="top: 100px; left: 0px;">Paste</button>
<button class="button Normal" style="top: 0px; left: 100px;">Select
all</button>
<button class="button Small" style="top: 50px; left: 150px;">x</button>
<button class="button Normal" style="top: 100px; left: 100px;">Undo</button>
</body></html>
)

Gui, Add, ActiveX,  x2 y2 w300 h200 vdoc, HtmlFile
doc.write(html)
Gui, Show, w302 h202, ActiveX Html test
Return

GuiClose:
ExitApp
What do I have to do if I want to see rounded borders while using use HtmlFile instead of Shell.Explorer if I don't want to tinker with the registry?
Also, could someone explain me why and in what situations should someone use ActiveX: HtmlFile and why and when ActiveX: Shell.Explorer to display html?
Thank you in advance!
Last edited by Learning one on 20 Jan 2016, 02:54, edited 1 time in total.
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: ActiveX: Shell.Explorer vs HtmlFile, border-radius

18 Jan 2016, 06:25

Here's a solution if you want to avoid the registry. I use this all the time.
Usage:

Code: Select all

Gui Add, ActiveX, vWB w800 h600, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
document := WB.Document
document.open()
document.write(html)
document.close()
; ...
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: ActiveX: Shell.Explorer vs HtmlFile, border-radius

18 Jan 2016, 19:40

The meta tag and probably DOCTYPE must be in the original document loaded by the control, not written by document.write() after it has initialized the document.

As far as I'm concerned, there's no reason to ever use HtmlFile. And if you do, please don't call the variable "wb". It's not a WebBrowser control object; it's a HTMLDocument.
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: [solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

20 Jan 2016, 02:58

Coco, Lexikos, thank you again! :)
I'll use Gui Add, ActiveX, vWB w800 h600, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
P.S. wb variable name was left behind after quick copy/paste - it's now corrected; replaced with doc. :shh: ;)
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Re: [solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

01 Mar 2016, 01:10

Delighted to find this approach which works nicely to initialize and then write to an ActiveX control...

Code: Select all

Gui Add, ActiveX, vWB w800 h600, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
document := WB.Document
document.open()
document.write(html)
document.close()
... excepting that no scroll bars are present on the control.

Is it possible to use this AND have scroll bars ?

Thank you for any guidance.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: [solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

21 Mar 2016, 09:32

elmo wrote:Delighted to find this approach which works nicely to initialize and then write to an ActiveX control...

Code: Select all

Gui Add, ActiveX, vWB w800 h600, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
document := WB.Document
document.open()
document.write(html)
document.close()
... excepting that no scroll bars are present on the control.

Is it possible to use this AND have scroll bars ?

Thank you for any guidance.
Gui Add, ActiveX, vWB w800 h600 +VScroll +HScroll, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
elmo
Posts: 113
Joined: 09 Oct 2013, 09:08

Re: [solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

21 Mar 2016, 09:36

Thank you kczx3 as I was not aware of those options.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: [solved] ActiveX: Shell.Explorer vs HtmlFile, border-radius

21 Mar 2016, 09:45

No worries. I actually had the same issue not too long ago and just tried those options as a Hail Mary and they worked so :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mebelantikjaya, OrangeCat and 287 guests