![]() |
Forum Index : Microcontroller and PC projects : MMBasic 5.05.02 Beta 3
![]() ![]() |
|||||
Author | Message | ||||
DaveJacko Regular Member ![]() Joined: 25/07/2019 Location: United KingdomPosts: 83 |
Could anyone kindly tell me the esc codes to induce Teraterm to report mouse clicks? I've spent hours searching, to no avail. It would be really whizzy to use mouse clicks in an MMBasic program! Thanks so much to Geoff and Rob, the editor is now a pleasure to use! Try swapping 2 and 3 over |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
The following code was provided by Rob Rozee as a means of demonstrating how to get mouse clicks. I used the VT200 method in the MMBasic editor and it works perfectly. Geoff Const ESC=Chr$(27) Print "select mouse reporting mode" Print " 1) X10" Print " 2) VT200" Print "?"; Do: M$=Inkey$: Loop Until M$="1" Or M$="2" Print Chr$(13) M$ Print "select response protocol" Print " 1) normal" Print " 2) URXVT" Print " 3) SGR" Print "?"; Do: P$=Inkey$: Loop Until P$="1" Or P$="2" Or P$="3" Print Chr$(13) P$ Print "press ctrl-Z to exit" ' ' NOTES: ' ===== ' X10 only reports mouse down events, and does not encode shift, control, alt ' VT200 reports mouse down and up events, plus modifier keys that are pressed ' ' "normal" encoding always returns 6 characters: ESC [ M Cb Cx Cy ' URXVT encodes as ESC [ num ; num ; num M ' SGR encodes as ESC [ < num ; num ; num M/m (M = mouse down, m = mouse up) ' ' general VT200 is more useful, as it lets you make use of modifier keys ' "normal" is a fixed length string, but limited to 223 x 223 screen size ' SGR is slightly more complicated to decode, but screen size is not limited ' URXVT is not favoured as it is no improvement over SGR ' If M$="1" Then Print ESC "[?9h"; ' enable X10 mouse reporting If M$="2" Then Print ESC "[?1000h"; ' enable VT200 mouse reporting If P$="2" Then Print ESC "[?1015h"; ' select URXVT encoding (if available) If P$="3" Then Print ESC "[?1006h"; ' select SGR encoding (if available) Do Do: A$=Inkey$: Loop Until A$<>"" If A$=Chr$(27) Then Print If Asc(A$)<32 Then Print "<" Str$(Asc(A$)) ">"; Else Print A$; Loop Until A$=Chr$(26) Print ESC "[?1006l"; ' disable SGR encoding Print ESC "[?1015l"; ' disable URXVT encoding Print ESC "[?1000l"; ' disable VT200 mouse reporting Print ESC "[?9l"; ' disable X10 mouse reporting Geoff Graham - http://geoffg.net |
||||
DaveJacko Regular Member ![]() Joined: 25/07/2019 Location: United KingdomPosts: 83 |
Fantastic ! Thanks Geoff. PS I still find people who look down on BASIC, maybe it's the name. Perhaps we could rename mmbasic as "geoff"..or just "G" 'program written in G' sounds cool eh? Try swapping 2 and 3 over |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |