WinBlitz3D HELP needed (kevin?)

Blitz3D Forums/Blitz3D Programming/WinBlitz3D HELP needed (kevin?)

Danny(Posted 2005) [#1]
Hi All,

I'm dying to use WinBlitz3D for some editor I'm building - using windows controls & gadgets with a blitz 3d viewport..

But since the latest release Kevin uses the 'apiGetMessage()' inside the main WaitEvent() function to WAIT for an event to happen (mouse, keyboard, button click) as opposed to the 'apiPeekMessage()' that he used in previous (more limited) versions.

Here comes the BUT:
apiGetMessage() FREEZES the entire program until it receives some event (ie. a mouse move, button click, key press, etc).
apiPeekMessage() doesn't freeze and so keeps my 3d blitz window alive and happy (refreshing every frame), but it doesn't catch any mouse or keyboard events; making my 3d environment impossible to 'control' by mouse or keyboard :(

I am in seriously unfamiliar terriotory here, and have been hacking at it for more than 3 weeks now (between the soup and the potatoes).

Does anyone (kevin?) have any idea's or tips to share to resolve this? Anything appreciated!!!!

cheers,
Danny.


KuRiX(Posted 2005) [#2]
I have been looking into this and i can't understand why the apigetmessage blocks until a new events come. It should have an option to be non blocking, very strange!


Picklesworth(Posted 2005) [#3]
Does your editor need to update every single frame?
APE (my editor) uses the latest version of WinBlitz, and it only does input updates when the Blitz window is in focus.

My WinBlitz uses apiPeekMessage. I believe that it is the latest version. Mind you, this may be an addition by myself.
To tell if you have the latest version, look for the function "PopUpGadgetMenu".

Does your waitEvent() function have a section that looks sort of like this?
Case WM_NOTIFY
			;Notify "WM_NOTIFY"

			;Notify Hex(TCN_SELCHANGE) + " : " + Hex(PeekInt(WinProcReturn,$18))

			Select PeekInt(WinProcReturn,$18)

				Case NM_RCLICK
					ret_event = $401
					eventsource_RAW = PeekInt(WinProcReturn,$10)
					
					;Also does popup menu stuff
        			If apiIsWindow(eventsource_RAW) <> 0
        				Gadget_BankDATA = apiGetWindowLong(eventsource_RAW,GWL_USERDATA)
        				If Gadget_BankDATA > 0
        					;If PeekInt(Gadget_BankDATA,$00) = eventsource_RAW
        						PopUpGadgetMenu(eventSource_raw)
        					;EndIf
        				EndIf
                    EndIf
                    
                Case NM_DBLCLK
                    ret_event=$204
                    eventdata_raw=1
                    eventsource_RAW = PeekInt(WinProcReturn,$10)

				Case NM_CLICK,TVN_SELCHANGEDA,TCN_SELCHANGE ; tabber
					ret_event = $401
					eventsource_RAW = PeekInt(WinProcReturn,$10)
					eventdata_RAW = apiSendMessage(eventsource_RAW,TCM_GETCURSEL,0,0)
					
                Case NM_KEYDOWN,TVN_KEYDOWN
                    eventsource_RAW = PeekInt(WinProcReturn,$10)
                    eventdata_raw=LOWORD(PeekInt(WinProcReturn,$08)) ;Key is one of the VK_ constants
                    ret_event=$101

I use that for mine, and it gets the proper input events for gadgets.
I find that resorting the windows can help, too. There is an unfortunate link between how many parents a window has and what kind of messages it sends to WinBlitz.
Remember: Only you can see how messy things are :)


Danny(Posted 2005) [#4]
Cheers for the feedback Mr. Picklesworth!

You defenetly have a newer/different version of WinBlitz than I do (I have the 'public release version' of about 4 months ago). And I do have the PopUpGadgetMenu function but, by the looks of it, your waitEvents() is totally different than mine!!! I've looked everywhere but can't find a version that comes even close to the code you posted!

I do need the 'every frame refresh' to be able to control animation options in my editor. And I HAVE managed to get around that... .But the biggest problem is that i am NOT ABLE AT ALL to get ANY keyboard or mouse feedback using the apiPeekMessage function!! Not from native blitz function nor from the WinBlitz routines :(

It seems you do have found a way around it. Any chance of sharing this ??? (pretty please ;).


Kev(Posted 2005) [#5]
@Danny

Please bare with me on this, things are coming along slow but this is because im trying to juggle my 6 month old son, winblitz3d and my blitzmax project. ive gadgets working directly in the blitz-runtime window but in .dll i am going
to convert this to internal blitz source as soon as possable.

@KuRiX
apigetmessage waits for each event in the message queue, blame microsoft for this :)

btw, im sure Mr Picklesworth would be willin to share his modifyed winblitz3d include file.

kev


Danny(Posted 2005) [#6]
Cheers for that Kevin!

And good luck with the sleepless nights ;)

-Danny


Picklesworth(Posted 2005) [#7]
Heh, sure, I'll share.
But don't replace your other version of WinBlitz, because this file is a bit untrustworthy. There may be chunks hard-coded around my editor, and a few strange redundancies and stupid functions that you will have to put up with. I would recommend copying and pasting what you want into another copy of WinBlitz3d_Include.bb.

I've also included my nearly uncommented (Yay!) GUI file, which may have a few handy tips and tricks, or things.

http://crumbsoftware.f2o.org/files/WinBlitzFiles.zip


KuRiX(Posted 2005) [#8]
Hey Kev, of course i am blaming microsoft for that!, i know that this is a microsoft problem, so i wonder why they did it this way?

Anyway, congratulations for WinBlitz, is amazing!!!


Kev(Posted 2005) [#9]
@Danny,
yes and the early mornings are a killer too, but hes worth it :)

@KuRiX,
im not sure why microsoft done it, but i suppose thats why they have peekmessage. but there's problems when mixing blitz3d/gui. but the new way im doing it does not require you to wait for messages. im using blitz's own message handler's.

@Mr. Picklesworth
thanks for that dylan.

kev


Danny(Posted 2005) [#10]
Thanks Dylan!
After some hacking, I finally got keyboard and mouse control again in Blitz!!! Cheers for that..

Crapper is that I now my treeview nodes have gone deaf, and my edit boxes don't accept keystrokes anymore :)p

So I guess I still got some hacking to go ;)
I'll keep you posted.

cheers all,
D.


Picklesworth(Posted 2005) [#11]
What is your treeview parented to?
I find, strangely, that the most prominent messages returned by windows are different based on how many parents they have. For example, my object called entList is currently not parented to the groupbox that it appears to be inside of. This way, it returns all keyboard and mouse events to the main window. This way, I have full control over the object. If I had it actually parented to the groupbox, it would be returning proper events through WM_NOTIFY, which are all mostly events returned as $401. An example of a gadget that returns proper messages is created with SetUp_VarsList. With that list view, there wasn't a reason to get mouse and keyboard events - Just actual gadget events telling me when something has been selected, clicked (fully clicked), etc.
Thus, through the WM_NOTIFY segment of WaitEvent is the best way to get messages, because they are always right and proper. (Whereas, getting click messages is a bit untrustworthy and hack feeling)

I hope that made sense, I always write a bit strangely when I go off on tangents like that :)
So, see if your gadgets are actually recieving some kind of messages, and try to sort it out so they recieve the kind that you want them to recieve.

Winblitz takes a bit of fiddling, but it's well worth it once it's all working!


Danny(Posted 2005) [#12]
I hear what you're saying Mr. Picklesworth...

And I agree that the fiddling is worth it, but I've been hacking at it for nearly a month now, trying to get my head around it - time to start using it ;)

I've seen the effect of parenting one gadget into another - or into another window, etc. But I still have no idea what the rules or regulations are, and unable to create a stable environment that doesn't fold when you add something else :/

Anyway I've got a very acceptable mix right now between what I had and what you send me. Full control in blitz and full control over my gadgets - just not at the same time.
I can't have blitz refreshing everyframe AND keep all the gadgets (menu, trees, editbox's) working at the same time. So I go for the stop-play space bar routine for now ;)

Cheers mate(s),
D.