HTMLview and Tabber gadget

BlitzPlus Forums/BlitzPlus Programming/HTMLview and Tabber gadget

Working on a simple desktop app that displays canvas based graphics in some of the tabs and html pages in others. Things work great until I add an htmlview gadget to one of the tabber gadget's tabs. Extra Mousewheel events start cropping up and the htmlview gadget tends not to give up the focus. Here's some sample code that reproduces the effect:

; Moving the mousewheel
; should only generate one event from window
;
; on initial run (when showing the Time tab) generates:
;		one event from panel2 (HTMLVew gadget) and
;		two events from window (one too many)
;
; selecting the Rectangle tab temporaraly fixes this and generates:
;       one event from window
;
; selecting the HTMLView tab generates:
;		one event from window (as long as the web page has not been clicked on -- given focus)
;       no event from window if the window can scroll
;       one event from window if the window can't scroll
;
; after moving from the HTMLview window, the mousewheel still acts as though the HTMLview is the focus
;
window = createwindow("HTMLView gadget bug", 40,40,800,600)
tabber = createtabber(0,0,600,400,window)

addgadgetitem tabber,"Time"
addgadgetitem tabber,"Rectangle"
addgadgetitem tabber,"HTMLView"

panel0 = createpanel(0,0,600,400,tabber)
canvas0 = createcanvas(0,0,600,400,panel0)

panel1 = createpanel(0,0,600,400,tabber)
canvas1 = createcanvas(0,0,600,400,panel1)
hidegadget panel1

panel2 = createpanel(0,0,600,400,tabber)
html2 = createhtmlview(0,0,600,400,panel2)
htmlviewgo html2,"www.blitzbasic.com"
hidegadget panel2

starttime = millisecs()

setbuffer canvasbuffer(canvas1)
color 128,100,100
rect 20,20,50,50,True

fps = CreateTimer (60)
Repeat
	Repeat	; Event processing loop (repeats until 'fps' timer event occurs)...
		event = WaitEvent () ; Wait for any event or the FPS timer to 'tick'
		if event=516 then DebugLog "Event,EventData,EventSource,EventX,EventY["+event+","+EventData()+","+EventSource()+","+EventX()+","+EventY()+"]"
		Select event
			Case $803	; close window
				End
			Case $204	; MouseWheel moved
				debuglog "Mousewheel detected: ["+eventdata()+"]"
			case $401   ; gadget action (including clicking on a tab)
			    select eventsource()
			        case tabber
			            select eventdata()  ; which tab
			                case 0
								hidegadget panel1
								hidegadget panel2
			                    showgadget panel0
			                case 1
								hidegadget panel0
								hidegadget panel2
			                    showgadget panel1
			                case 2
								hidegadget panel0
								hidegadget panel1
			                    showgadget panel2
						end select
			    end select
		End Select
	Until event = $4001   ; only render on a timer tick to limit redraw to fps framerate

	setbuffer canvasbuffer (canvas0)
	cls
	color 128,128,128
	text 100,100,"Seconds since start: ["+str$(int((millisecs()-starttime)/1000))+"]"
	flipcanvas canvas0
	flipcanvas canvas1
forever
End



At initial startup, I get three mousewheel events when moving the mouse wheel, one from panel2 and two from window. If I click on the Rectangle tab I get just one mousewheel event from window. When I select the HTMLview tab, I still only get one mousewheel event (from window) until I click within the web page (giving it focus I suppose). Lastly, if I return to either one of the other tabs, my mousewheel events are still going to the htmlview gadget.

So, how do I stop this effect and only get one mousewheel event?

I've tried hidegadget on the parent panel, the htmlview gadget and both as well as freegadget on both without success. I'm stumped - is this how the htmlview gadget is supposed to work?

Not that it's any real help to you, but I had a simmilar problem with the htmlview control. I have had to make a dll that subclasses the htmlview, and sends keyboard messages to another Blitz window. As it is now the htmlview simply steals the input.

I had trouble with this when working on butane. I ended up just making it create several html views and hide all the ones that weren't supposed to be selected and show the ones that were supposed to be selected. This fixed it.

I finally came up with a workaround. I simply look for the Mouse Enter event ($205) for each any of my canvases and activate that canvas (activategadget). This pulls the focus off the HTML gadget which in turn reduces the bogus mousewheel events (one from the underlying window gadget and one from the true canvas).

I would have preferred a focus adjustment on exiting the HTMLgadget but at least I can move forward now.

If you were to add a couple of buttons to the HTMLVIEW tab how would you catch there button events ?

Thanks,

Rod