mouse wheel to increase decrease a value

Started by RemiD, September 28, 2023, 11:24:58

Previous topic - Next topic

RemiD

i have probably already posted such example in some of my others code examples, but i don't remember where or when...

use the mouse wheel to increase (+1) or decrease (-1) a value.

;mouse wheel to increase (+1) or decrease (-1) a value by RemiD (20230928)

Graphics( 854, 480, 32, 2 )

Global MZOld% = 0
Global MZCur% = 0
Global MWheel% = 0

Global ValueInt% = 0

Main()

End()

Function Main()

 Repeat

  MWheel = 0
  MZCur = MouseZ()
  If(MZCur > MZOld)
  MWheel = + 1
  MZOld = MZCur
  ElseIf(MZCur < MZOld)
  MWheel = - 1
  MZOld = MZCur
  EndIf

  If( MWheel = + 1 )
  ValueInt = ValueInt + 1
  Else If( MWheel = - 1 )
  ValueInt = ValueInt - 1
  EndIf

  SetBuffer( BackBuffer() )
  ClsColor( 000, 000, 000 ) : Cls()

  Color( 240, 240, 240 )
  Text( 854/2-StringWidth(ValueInt)/2, 480/2-StringHeight(ValueInt)/2, ValueInt )

  Flip(1)

 Until( KeyDown(1)=1 )

End Function

Baggey

Running a PC that just Aint fast enough!? i7 4Ghz Quad core 32GB ram  2x1TB SSD and NVIDIA Quadro K1200 on Acer 24" . DID Technology stop! Or have we been assimulated!

Windows10, Parrot OS, Raspberry Pi Black Edition! , ZX Spectrum 48k, C64, Enterprise 128K, The SID chip. Im Misunderstood!

RemiD