Jump to content


Photo

HTML Based GUI (_L)


  • Please log in to reply
6 replies to this topic

#1 FischGeek

FischGeek
  • Members
  • 991 posts

Posted 20 July 2012 - 01:16 AM

I'm playing around with HTML based GUIs, but I can't seem to get rid of the VScroll in the GUI. What am I missing?
html=<html><head></head><body><p>Hello</p></body></html>
Gui, Add, ActiveX, w500 h500 x0 y0 vdoc, HTMLFile
doc.write(html)
Gui, Show, w500 h500 Center, HTML Gui
ComObjConnect(doc, Document)
return

GuiClose:
ExitApp


#2 dylan904

dylan904
  • Members
  • 706 posts

Posted 20 July 2012 - 02:36 AM

Sure, try this...
Gui, Add, ActiveX, w500 h500 x0 y0 vdoc, browser
doc.silent := true
ComObjConnect(doc,"IE_")
IE_DocumentComplete(doc) {
   doc.Document.Body.Style.Overflow := "hidden"
}
Gui, Show, w500 h500 Center, HTML Gui
return

GuiClose:
Gui, Destroy
ExitApp

From here http://www.autohotke...pic.php?t=79654

#3 Lexikos

Lexikos
  • Administrators
  • 8845 posts

Posted 20 July 2012 - 03:48 AM

DocumentComplete won't fire unless you load a document, such as about:blank. Even after adding doc.Navigate("about:blank"), the event would not fire until I replaced "browser" with "Shell.Explorer", although they appear to be the same type of object (note: it's a WebBrowser object, not a document).

I did something similar via CSS for the new AutoHotkey_L v1.1.08 installer. I also used background-color: ButtonFace and cursor: default to make it more like an ordinary GUI. Once v1.1.08 is installed, Installer.ahk is in the AutoHotkey directory. You might want to take a look at gui_KeyDown() which gets "keyboard accelerators" such as Tab and Enter working.

There's something odd about using MSHTML (HTMLFile) directly vs using a WebBrowser (Shell.Explorer) control. I don't recall exactly what.

#4 flyingDman

flyingDman
  • Members
  • 1072 posts

Posted 20 July 2012 - 05:28 AM

What about this?:
html=
(
<!DOCTYPE html><html><head>
<STYLE TYPE="text/css" MEDIA=screen>
<!--
html { overflow:hidden}
-->
</STYLE></head>
<body>look: no scroll bar!</body></html>
)
Gui, Add, ActiveX, w500 h500 x0 y0 vdoc, HTMLFile
doc.write(html)
Gui, Show, w500 h500 Center, HTML Gui
ComObjConnect(doc, Document)
return

GuiClose:
ExitApp


#5 FischGeek

FischGeek
  • Members
  • 991 posts

Posted 20 July 2012 - 01:29 PM

Once v1.1.08 is installed, Installer.ahk is in the AutoHotkey directory.

Yep! :wink: - That's what led me to looking for how to make an html based gui. I was very impressed by the installer. Thank you for the source code.

#6 jethrow

jethrow
  • Fellows
  • 2549 posts

Posted 21 July 2012 - 06:12 AM

There's something odd about using MSHTML (HTMLFile) directly vs using a WebBrowser (Shell.Explorer) control. I don't recall exactly what.

Maybe this? Additionally, I remember not being able set the body background color in the initial html ( <body style='background-color:%color%;overflow:hidden'></body> ) when using MSHTML:%html%, though you could set it afterwards ( Document.Body.Style.backgroundcolor := color ). I never had this issue when using the HTMLfile object & then writing the html.

#7 Lexikos

Lexikos
  • Administrators
  • 8845 posts

Posted 21 July 2012 - 09:22 AM

Scripts supposedly don't work with MSHTML:%html% either, but they seem to work with HTMLfile.

Anyway, I'm fairly certain you get the same type of host window, the same rendering engine etc., but using Shell.Explorer gives you more control - you get all the methods and events of the WebBrowser control instead of just a document object. The downside is that you have to load a document (like about:blank) and then wait for it to initialize before getting a handle on the document object.