July 13, 2024, 08:29:56 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Pic in Browser Window problem

Started by Junner2003, January 27, 2007, 11:12:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Junner2003

I started to modify the SIMPLE_BROWSER code sample. My idea was to load  later an animated GIF file, so, the WINDOW would not look so boring. For the test I work with a jpg file (attached). My problem is that I can't disable the view of the vertical toolbar in the browser window. Is there a trick?

QuoteAUTODEFINE "OFF"
DEF win,browserwin:WINDOW
DEF run,screenW,screenH:INT
GETSCREENSIZE screenW,screenH

OPENWINDOW win,0, 0, 600, 400,@CAPTION|@topmost, 0, "", &main
OPENWINDOW browserwin, 10,10,180,180,@NOCAPTION,win, "", &main
ATTACHBROWSER(browserwin)
BROWSECMD browserwin, @NAVIGATE ,GETSTARTPATH+"pic01.jpg"

run = 1
WAITUNTIL run = 0
CLOSEWINDOW win
END

SUB main
   SELECT @CLASS
     CASE @IDCLOSEWINDOW
       run = 0
   ENDSELECT
RETURN
ENDSUB

Doc

Hey Junner,
Located somewhere deep in the API's for the browser there *is* a way to do it, but I've never figured it out.
Instead, I would normally add another window that is smaller than the browser window and then set the browser as a child of that window. That will effectively hide the scrollbar. Try this:

AUTODEFINE "OFF"
DEF win,browserwin,cover:WINDOW
DEF run,screenW,screenH:INT
GETSCREENSIZE screenW,screenH
OPENWINDOW win,0, 0, 600, 400,@CAPTION|@topmost, 0, "", &main
OPENWINDOW cover,0, 0, 170, 180,@NOCAPTION|@NOAUTODRAW,win, "", &main
OPENWINDOW browserwin, 10,10,180,180,@NOCAPTION,cover, "", &main
ATTACHBROWSER(browserwin)
BROWSECMD browserwin, @NAVIGATE ,GETSTARTPATH+"pic01.jpg"

run = 1
WAITUNTIL run = 0
CLOSEWINDOW win
END

SUB main
SELECT @CLASS
  CASE @IDCLOSEWINDOW
    run = 0
ENDSELECT
RETURN
ENDSUB


Hope that helps.

-Doc-

Junner2003

I was thinking about something similar to this. :)
My idea after I started the thread was to just load a plain white picture over the scrollbar - haven't tried it yet but just putting another window over it sounds easier. The problem are the controls I want to add later ... might be that that will get messed up, I will see!

Thanks! ;)

Doc

Forgot to mention that by keeping the browser itself in a smaller "container window", it makes it easy to move it around anywhere you want it in the main window without much trouble. Container Window: Hide/Move/Show Again  :D

-Doc-

LarryMc

Quote from: David Coker on January 27, 2007, 12:24:35 PM
Forgot to mention that by keeping the browser itself in a smaller "container window", it makes it easy to move it around anywhere you want it in the main window without much trouble. Container Window: Hide/Move/Show Again  :D

-Doc-
That's the technique I use also in my image manipulator.

Doc,
In your example you are accounting only for the vertical scroll bar.  If the image is wider than the browser window the horizonal scrollbar will also popup.


Another technique I use to get rid of the h/v scrollbars is to first scale my image, maintaining ratio, so that it is no larger than the browser window.
I then create 2 html pages.
The first creates a frameset with only one frame that has scrolling=no. The frameset, when loaded, loads the 2nd html page  with the image imbedded in it.  The frameset html page I call  the index.html and never changes.
The 2nd html page has a fixed-name like meat.html that is regenerated under program control to change the image.

I use this frameset/noscrolling scheme on my genealogy website.

Might be an easier way but this one works for me.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Doc

Hey Larry!
You are another fan of the little browser window I see... so you can officially join the "browser head club" along with Jerry, myself and a few others.  ;)

QuoteDoc,
In your example you are accounting only for the vertical scroll bar.  If the image is wider than the browser window the horizonal scrollbar will also popup.
Yepper, I just threw the sample together quickly to show a simple solution for the vertical scrollbar, which is what he was having difficulties with. In a real app I would have added the code to accommodate the horizontal version as well.

I like the way you are using the frame setup... sounds like a plan to me.
Somewhere I have some HTML (with a little Javascript) that I always used to "house" my images and or other goodies that I wanted to add to the browser. Basically, it was used to stop any right-click activity and/or control the scrollbars. I typically added the HTML, images and everything to the executable as resources, so the user had no clue it was actually a web page. ;)

There is pretty much no end to what you can do with an embedded browser for special projects and it's easier to use than many other solutions. Welcome to the club!  ;D ;D ;D

-Doc-

LarryMc

Yep, I like the browser window.
I've got an application where I have the wysiwyg editor "tiny_mce" loads and saves web pages I create and edit.

Love it! ;D
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library