Sign in to follow this  
Followers 0
ivan

Removing client edge from gui embedded IE

11 posts in this topic

This is my firts embedded internet explorer, which I am using more like a rich edit control, as I can embed swf files, animated gifs and the rest, providing text formatting ....

Anyway, I see that GUICtrlCreateObj does not have style definitions, and I'd ideally like to remove the client edge from the embedded explorer.

Any suggestions??

IVAN

Share this post


Link to post
Share on other sites



I'm not certain what you mean by "client edge". If it is something controlled by the browser, you'll want to look at properties of the "body" object like bottom|left|top|right margin, scroll, marginheight and marginwidth. Eg.

$oIE.document.body.scroll = "no"

Dale

p.s. make certain the document is fully loaded prior to trying to set these properties


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

thx for your reply Dale.

Actually, I do use the scroll bar and have your babe ie.au3 create cool scrolls , for instance, I use

scrollbar-3dlight-color: White;
    scrollbar-arrow-color: #660000;
    scrollbar-base-color: #F8DDBC;
    scrollbar-shadow-color: #462300;
    scrollbar-track-color: #DDD9DA;
    scrollbar-darkshadow-color: Black;
    scrollbar-highlight-color: FEF9C4;
    scrollbar-face-color: #F6931E;

within the <style type="text/css"></style> tag of the initial page (which is under my control).

What I mean is that the gui creates an edged box where the browser is embedded, and I'd love to get rid of it.

By the way, after Ecuador was eliminated I wanted Germany to win the World Cup. Shame it didn't.

Regards,

IVAN

Share this post


Link to post
Share on other sites

I read back my last post and it actually does not clarify at all what I mean, so I'll post a simplification of the gui

#include <GuiConstants.au3>; Gui
#include <Constants.au3>; Gui
#include <IE.au3>; hypertext style support

$style='body {background: FEF9C4; font-family: sans-serif; font: normal sans-serif; font-size: small; scrollbar-3dlight-color: White; scrollbar-arrow-color: #660000; scrollbar-base-color: #F8DDBC; scrollbar-shadow-color: #462300; scrollbar-track-color: #DDD9DA; scrollbar-darkshadow-color: Black; scrollbar-highlight-color: FEF9C4; scrollbar-face-color: #F6931E;}'

$html='<html>' & @CR & '<head>' & @CR & '<style type="text/css">' &$style &'</style>' & @CR & '</head>' & @CR & '<body oncontextmenu="return false">' & @CR & '</body>' & @CR & '</html>'

   $HtmlFileHndl = FileOpen('blank.html', 2)
   FileWriteLine($HtmlFileHndl, $html)
   FileClose($HtmlFileHndl)

_IEErrorHandlerRegister () 
$oIE = _IECreateEmbedded ()
$NiuGui = GUICreate("Niu", 600, 600, (@DesktopWidth / 2) - (800 / 2) , (@DesktopHeight / 2) - (600 / 2), $WS_POPUP+$WS_CLIPCHILDREN+$WS_CLIPSIBLINGS)
GUISetBkColor(0xFEF9C4, $NiuGui)
_GuiRoundCorners($NiuGui, 0, 0, 150, 150)
$GUIActiveX = GUICtrlCreateObj($oIE, 25, 250, 550, 150)
GUISetState()
_IENavigate ($oIE, @ScriptDir &"\blank.html")
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case Else
   EndSelect
WEnd

exit

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
   $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
   If $ret[0]Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0]Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc  ;==>_GuiRoundCorners

I also froze part of the edge I want to get rid of so I attach a gif.

Regards,

IVAN

Share this post


Link to post
Share on other sites

I have to admit to being a rookie with CSS -- I've only learned what I needed.

Have you tried the css border attributes however? Here is a link with some good examples

It is also not clear to me if this is the parent GUI that is adding this or whether it it the webbrowser control.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Thanks for the tips you Genius!!!!!!!! :D

Setting the border attribute of the body element to 0 worked perfectly! I thought it had to do with the gui control, as other controls have style settings.

Below is the modified $style for the above gui. I split the var so that it is more readable, adding the border attribute with a 0 px value.

$style='body {'

$style &= 'background: FEF9C4;'

$style &= 'font-family: sans-serif;'

$style &= 'font: normal sans-serif;'

$style &= 'font-size: small;'

$style &= 'scrollbar-3dlight-color: White;'

$style &= 'scrollbar-arrow-color: #660000;'

$style &= 'scrollbar-base-color: #F8DDBC;'

$style &= 'scrollbar-shadow-color: #462300;'

$style &= 'scrollbar-track-color: #DDD9DA;'

$style &= 'scrollbar-darkshadow-color: Black;'

$style &= 'scrollbar-highlight-color: FEF9C4;'

$style &= 'scrollbar-face-color: #F6931E;'

$style &= 'border: 0px;'

$style &= '}'

In relation to which is the parent gui, I think I understand what you mean.

$NiuGui should be the parent gui.

As this is the first time I'm embedding browsers, I took the sintax straight out of the help file, but now that you mention it it makes more sense to create the gui first and then doing the embedding on that gui.

So, instead of having

bla...

_IEErrorHandlerRegister () 
$oIE = _IECreateEmbedded ()
$NiuGui = GUICreate("Niu", 600, 600, (@DesktopWidth / 2) - (800 / 2) , (@DesktopHeight / 2) - (600 / 2),

The embedding order should be:

$NiuGui = GUICreate("Niu", 600, 600, (@DesktopWidth / 2) - (800 / 2) , (@DesktopHeight / 2) - (600 / 2), $WS_POPUP+$WS_CLIPCHILDREN+$WS_CLIPSIBLINGS)

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

I got rid of the window title bar and rounded the edges with a udf i found in the forums. In fact, the real thing contains a pic control which has the drag attribute of the title bar as follows:

$ctrlNiuTitleBar = GUICtrlCreatePic($igResourceDir & "NiuTitleBar.jpg", 0, 0, 600, 75, -1, $GUI_WS_EX_PARENTDRAG)

there's other pic controls which act like buttons.

Anyway, Dale I owe you another beer if you visit Ecuador.

Thanks,

ivan

Share this post


Link to post
Share on other sites

Good job ivan. This looks very interesting. I would love to see you post a generic sample when you are done as I think others may find it very useful.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

@ Dale,

I'm not so good with css, just basic formatting, but it helps to have a good css editor at hand. I use TopStileLite, i.e., the cheap (freeware) version.

It helps if your css editor can render the resource in a visual format, but nothing beats experimenting.

I'll give it a shot at attempting to make a generic udf to deal with basic formatting, although as you are aware, the DOM is quite extensive, so handling styles for different elements can turn into a huge task. Making a contribution like that will make me feel a lot better as a member of the AU3 community. One always has the leech feeling of taking and not giving in return.

The main reason for embedding the browser this time was to display text with format and combining graphical resources to the user, which is not currently possible with an edit control. I had to work on how to get rid of the context menu in the body tag with <body oncontextmenu="return false">. Although it was also necessary to add navigating capabilities to enter a home page.

Regards,

IVAN

Share this post


Link to post
Share on other sites

I'll give it a shot at attempting to make a generic udf to deal with basic formatting, although as you are aware, the DOM is quite extensive, so handling styles for different elements can turn into a huge task. Making a contribution like that will make me feel a lot better as a member of the AU3 community. One always has the leech feeling of taking and not giving in return.

That wasn't really what I was suggesting -- I just meant a nice GUI with rounded edges with examples of displaying different types of media -- but it might be a really useful tool to have something taht manipulates CSS as well.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

I went off at a tangent, didn't I?...

The round edge script is not mine, I borrowed it from gaFrost.

The topic can be found in the scripts and scraps following this link

round corners

For some reason I'm getting broken links so this is the original code.

#include <GuiConstants.au3>

$my_gui = GuiCreate("Niu", 800, 600)

_GuiRoundCorners($my_gui, 0, 0, 50, 50)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)

Dim $pos, $ret, $ret2

$pos = WinGetPos($h_win)

$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)

If $ret[0] Then

$ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)

If $ret2[0] Then

Return 1

Else

Return 0

EndIf

Else

Return 0

EndIf

EndFunc ;==>_GuiRoundCorners

As for using ie.au3 to embed a text simulating rich media, the idea is cool, so when i'm finished i'll certainly get down to coding something of a more general nature.

I still feel I owe so much to this community that I can surely commit to a retribution, of course limited by my skills.

IVAN

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0