April 28, 2024, 05:44:35 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Graphic in browser control

Started by Pip1957, November 12, 2008, 08:27:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Pip1957

I am building an assessment program for work, at the moment I use bitmap buttons with a checkbox or radio button with them to show graphics in multi choice questions which works ok but some of the graphics are quite big in bitmap form, would it be possible to use the embedded browser control instead so I could use gif, png and jpg files to reduce size if so is there any way to retrieve the filename of the graphic when the radio or checkbox button was selected. ???

sapero

November 12, 2008, 09:55:26 AM #1 Last Edit: November 12, 2008, 10:22:45 AM by sapero
I am very familiar with browser internals and I can say anything is possible. Just give me a hint, function name, parameters or precise idea what do you want to do with the browser (what kind of operations - read checkbox state, input.value ...)

Pip1957

November 12, 2008, 10:04:10 AM #2 Last Edit: November 12, 2008, 10:20:51 AM by Pip1957
Use the browser control to display the graphic in a dialog with a checkbox or radio button in the dialog when button selected retreive graphic file name if possible, there could be more than one browser control and button in the dialog. The checkbox or radio buttons are not in the browser.

sapero

What about
type BROWSERDATA
WINDOW browser
string imagepath
endtype

BROWSERDATA browsers[array_size]

' remember to call
' openwindow browsers[index].browser
' attachbrowser browsers[index].browser

browsers[index].imagepath = "file://some path.png"
BROWSECMD(browsers[index].browser, @BROWSELOAD, szHtml)

where szHtml is
"<html><body><image src='" + "file://some path.png" + "'></body></html>"

aurelCB

Hi ...
I have question conected with this topic.
How open and load html or htm file from folder to browser control?
So what i want?
I want make simple program like " help program".
I want see in browser control htm file when i click on button.
Here is skeleton program:

def w1,wb:window
def hfile:file
OPENWINDOW w1,0,0,600,400,@minbox,0,"View Html File",&main
Setwindowcolor w1,rgb(200,200,200)
CONTROL w1,@BUTTON,"OpenHtml1",10,12,90,22,0x50000001,1
SETFONT w1,"MS Sans Serif",8, 400,0,1
'Open browser CONTROL
OpenWindow wb,120,10,430,350,@NOAUTODRAW|@NOCAPTION|@border,w1,"",&main


Waituntil w1=0
End

SUB main
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
CASE @IDCLOSEWINDOW
CLOSEWindow w1
'----------------------------------------------------------------------------
CASE @IDCONTROL
IF @controlid=1

'What I must add here for load specific html or htm file in browser?
'For example help1.htm or help1.html
ENDIF
'----------------------------------------------------------------------------
ENDSELECT
RETURN
ENDSUB


Thanks advance
Zlatko

sapero

Use @navigate command and specify local file path prefixed with file://
def w1,wb:window
OPENWINDOW w1,0,0,600,400,@minbox,0,"View Html File",&main
Setwindowcolor w1,rgb(200,200,200)
CONTROL w1,@BUTTON,"OpenHtml1",10,12,90,22,0x50000001,1
SETFONT w1,"MS Sans Serif",8, 400,0,1
'Open browser CONTROL
OpenWindow wb,120,10,430,350,@NOAUTODRAW|@NOCAPTION|@border,w1,"",&main
Waituntil w1=0
End

SUB main
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW w1
/*MISSING*/attachbrowser wb
browsecmd wb, @GOHOME
CASE @IDCLOSEWINDOW
CLOSEWindow w1
'----------------------------------------------------------------------------
CASE @IDCONTROL
IF @controlid=1
/*MISSING*/browsecmd wb, @navigate, "file://C:\\WINDOWS\\pchealth\\helpctr\\System\\sysinfo\\sysComponentInfo.htm"
ENDIF
'----------------------------------------------------------------------------
ENDSELECT
RETURN
ENDSUB

aurelCB


Pip1957