mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-26 15:35:53 +00:00
Added new _STRCMP and _STRICMP commands for quick string comparisons. Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders. Altered UCASE and LCASE routines to be faster in some situations for us.
55 lines
2.2 KiB
Plaintext
55 lines
2.2 KiB
Plaintext
'''_MOUSEY''' Function returns the current vertical(row) mouse cursor position when read after [[_MOUSEINPUT]].
|
|
|
|
|
|
{{PageSyntax}}
|
|
::: row% = {{KW|_MOUSEY}}
|
|
|
|
|
|
''Usage:''
|
|
* [[SCREEN]] 0 returns the [[SINGLE]] vertical text row position. Graphic screens return the [[INTEGER]] pixel row.
|
|
* To calculate text rows in graphic modes divide the return by 16 or the [[_FONTHEIGHT]] of [[_FONT]] characters.
|
|
* [[_MOUSEINPUT]] MUST be used to detect any changes in the mouse position and is '''required''' for any coordinate returns.
|
|
|
|
|
|
''Example:'' Highlighting a row of text in Screen 0.
|
|
{{CodeStart}} '' ''
|
|
minX = 20: maxX = 60: minY = 10: maxY = 24
|
|
selection = 0 'the screen Y coordinate of the previously highlighted item
|
|
{{Cl|FOR}} i% = 1 {{Cl|TO}} 25: {{Cl|LOCATE}} i%, 40: {{Cl|PRINT}} i%;: {{Cl|NEXT}}
|
|
{{Cl|DO}}: {{Cl|_LIMIT}} 100
|
|
{{Cl|IF}} {{Cl|_MOUSEINPUT}} {{Cl|THEN}}
|
|
'Un-highlight any selected row
|
|
{{Cl|IF}} selection {{Cl|THEN}} selectRow selection, minX, maxX, 0
|
|
x = {{Cl|CINT}}({{Cl|_MOUSEX}})
|
|
y = {{Cl|CINT}}({{Cl|_MOUSEY}})
|
|
{{Cl|IF}} x >= minX {{Cl|AND (boolean)|AND}} x <= maxX {{Cl|AND (boolean)|AND}} y >= minY {{Cl|AND (boolean)|AND}} y <= maxY {{Cl|THEN}}
|
|
selection = y
|
|
{{Cl|ELSE}}
|
|
selection = 0
|
|
{{Cl|END IF}}
|
|
'Highlight any selected row
|
|
{{Cl|IF}} selection {{Cl|THEN}} SelectRow selection, minX, maxX, 2
|
|
{{Cl|IF}} {{Cl|_MOUSEBUTTON}}(1) {{Cl|THEN}} {{Cl|LOCATE}} 1, 2: {{Cl|PRINT}} x, y, selection
|
|
{{Cl|END IF}}
|
|
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} <> ""
|
|
|
|
{{Cl|SUB}} SelectRow (y, x1, x2, col)
|
|
{{Cl|DEF SEG}} = {{Cl|&H}}B800
|
|
addr& = (x1 - 1 + (y - 1) * {{Cl|_WIDTH (function)|_WIDTH}}) * 2 + 1
|
|
{{Cl|FOR}} x = x1 {{Cl|TO}} x2
|
|
oldCol = {{Cl|PEEK}}(addr&) {{Cl|AND (boolean)|AND}} {{Cl|&B}}10001111 ' Mask foreground color and blink bit
|
|
{{Cl|POKE}} addr&, oldCol {{Cl|OR}} ((col {{Cl|AND (boolean)|AND}} {{Cl|&B}}111) * {{Cl|&B}}10000) ' Apply background color
|
|
addr& = addr& + 2
|
|
{{Cl|NEXT}}
|
|
{{Cl|END SUB}} '' ''
|
|
{{CodeEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_MOUSEX]], [[_MOUSEBUTTON]], [[_MOUSEWHEEL]]
|
|
* [[_MOUSEINPUT]], [[_MOUSEMOVE]]
|
|
* [[_MOUSESHOW]], [[_MOUSEHIDE]]
|
|
* [[Controller_Devices]]
|
|
|
|
|
|
{{PageNavigation}} |