RE: LaGard (was no subject)

new topic     » topic index » view thread      » older message » newer message

Hi Tony,

Here's my quick 'n dirty analysis:

If you are going to have a w32HMouse handler, avoid also having a 
w32HClick handler.  Two routines essentially servicing one action is 
typically a bad thing.

Here's what I suggest... get rid of the click handler completely and do 
something like this:
-----------------------------

function getCurrentButton( integer x, integer y )
  -- If Button 1
	if x > 70 and x < 105 and y >46 and y < 75 then
		return 1
  -- If Button 2
	elsif x > 117 and x < 150 and y > 40 and y < 73 then
		return 2
  -- If Button 3
	elsif x > 164 and x < 195 and y > 45 and y < 73 then
		return 3
  -- If Button 4
	elsif x > 73 and x < 105 and y > 90 and y < 122 then
		return 4
  -- If Button 5
	elsif x > 121 and x < 151 and y > 89 and y < 121 then
		return 5
  -- If Button 6
	elsif x > 166 and x < 195 and y > 87 and y < 119 then
		return 6
  -- If Button 7
	elsif x > 75 and x < 106 and y > 139 and y < 169 then
		return 7
  -- If Button 8
	elsif x > 122 and x < 153 and y > 137 and y < 169 then
		return 8
  -- If Button 9
	elsif x > 166 and x < 196 and y > 136 and y < 166 then
		return 9
  -- If Button 0
	elsif x > 122 and x < 152 and y > 184 and y < 215 then
		return 0
  -- If Button * Ill call 11
	elsif x > 76 and x < 106 and y > 185 and y < 211 then
		return 11
  -- If Button # Ill call 12
	elsif x > 166 and x < 193 and y > 188 and y < 209 then
		return 12
	else
		return -1
	end if

end function

-----------------------------

procedure Bitmap2_onMouse (integer self, integer event, sequence 
params)--params is ( int event, int x, int y, int shift, int wheelmove )
    if params[1] = LeftUp then
        CurButton = getCurrentButton( params[2], params[3] )
	if CurButton > -1 then
		UpdateSession()
		CurButton = -1
	else
		setText(SBar, "")
	end if	
    end if
end procedure
setHandler( Bitmap2, w32HMouse, routine_id("Bitmap2_onMouse"))

-----------------------------


As for the LED, the generic answer is: just brighten the colors where 
the LED is...  I'd show you a quick way if I had my old programs in 
front of me.  Maybe somebody else can help with that.

-- Brian 

Tony Steward wrote:
> 
> 
> Hello,
> I am writing a safe lock emulator, but I have a couple of problems.
> 1. When I click differant areas ove a bitmap it sometimes registers 
> twice. - Not sure how to prevent this.
> 2. Part of the bitmap there is an LED. Is there a way I can make it 
> appear to blink on a mouse click without loading a whole second bitmap.
> 
> Find my code at www.locksdownunder.com/LaGard.zip
> 
> Any help or comments on a better way to do this would be appreciated
> 
> Thanks
> Tony
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu