Page 1 of 1

OnMouseDown

Posted: Sun May 01, 2011 3:19 pm
by djrikki
Hi,

Code: Select all

		case "OnMouseDown"
			if msg.id = #ARROWUP
				if listerY <> 0
					listerY = listerY - 1
					drawUI(0)
				endif
				
			elseif msg.id = #ARROWDOWN

				if listerY <> p_tableSize(listing$)-17 ; *** 17 is a temporary value ***
					listerY = listerY + 1
					drawUI(0)
				endif
			endif

 wait(10) ; a tiny delay so the lister doesn't move up or down too quickly / would be useful if this value decreased the longer the 
                                      ; button is held
I was hoping this piece of code would constantly run as long as I held the left mouse button down without me having to code anything further! But alas it does not! Is something blocking it from it re-iterating through the code? What should I do/look for?

Re: OnMouseDown

Posted: Mon May 02, 2011 12:12 am
by Bugala
I dont see error in that, but im not that good at spotting them either.

Maybe problem is elsewhere in the code.

Could be around the CheckEvent() somewhere. Maybe you cant enter twice to the place where CheckEvent() is when mousebutton is down.

Re: OnMouseDown

Posted: Mon May 02, 2011 3:11 am
by djrikki
Hi,

Well atm I am not using CheckEvent all, I have a While....Wend loop with a WaitEvent within main(). With various events launched here and there in different routines, can't post complete source - much too many lines, if I can't find a solution I'll upload the project to OS4Depot nearer the time of completion and hope so one can take a look at the source code and come up with answer.
I am also trying to implement a scrollbar which will also require not only OnMouseDown, but also the X and Y of the mouse pointer so its vital I find out what is happening.

Re: OnMouseDown

Posted: Tue May 03, 2011 1:02 am
by Bugala
try CheckEvent instead of WaitEvent.

Basically there shouldnt be much difference, but just came to my mind that what if there is bug in hollywood on usage of waitevent and onmousedown together.

I have used onmousedown to do things like growing speed bar or increasing throw power, and i think i used checkevent and onmousedown on button and it worked fine.