walt
New Member
Posts: 5
|
Post by walt on Aug 5, 2018 23:04:01 GMT -5
Mouse wheel doesn’t work in text window from compiled (.exe) app. Up arrow, down arrow, page up, page down, and scroll bar do work, just not mouse wheel.
However, mouse wheel does work in same window inside same app while inside Basic interpreter. I only noticed this issue when I compiled and executed.
Any help or discussion would be appreciated.
Thanks - Walt
|
|
|
Post by metro on Aug 6, 2018 0:48:45 GMT -5
Hi walt, yes its been reported before. I'm sure when Carl finds the time it will be fixed Thanks to Rod he has shown a work around
LotsOflines$(1)="A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core. " LotsOflines$(2)="Segfaults are caused by a program trying to read or write an illegal memory location. Program memory is divided into different segments: a text segment for program instructions, " LotsOflines$(3)="a data segment for variables and arrays defined at compile time, a stack segment for temporary (or automatic) variables defined in subroutines and functions, " LotsOflines$(4)="and a heap segment for variables allocated during runtime by functions, such as malloc (in C) and allocate (in Fortran). For more, see What are program segments," LotsOflines$(5)=" and which segments are different types of variables stored in? A segfault occurs when a reference to a variable falls outside the segment where that variable resides, " LotsOflines$(6)="or when a write is attempted to a location that is in a read-only segment. In practice, segfaults are almost always due to trying to read or write a non-existent array element," LotsOflines$(7)="not properly defining a pointer before using it, or (in C programs) accidentally using a variable's value as an address (see the scanf example below):"
NoMainWin
' Declare structs. Struct si, _ ' SCROLLINGO cbSize As ULong, _ fMask As ULong, _ nMin As Long, _ nMax As Long, _ nPage As ULong, _ nPos As Long, _ nTrackPos As Long
' Open DLLs. Open "WMLiberty" For DLL As #wmlib
[Main.Info]
BackgroundColor$ = "blue" ForegroundColor$ = "blue" TexteditorColor$ = "white"
WindowWidth = 1090 WindowHeight = 700
UpperLeftX = 200 UpperLeftY = 100
button #mnaiuto.st, "EXIT", [quit], UL, 940, 575, 100, 35 texteditor #mnaiuto.editor, 30, 30, 1010, 520
open "Gestione Utenti - Aiuto" for window as #mnaiuto #mnaiuto, "font courier_new 10 16 bold" #mnaiuto, "trapclose [quit]" #mnaiuto.editor, "!enable"
for a = 1 to 7 #mnaiuto.editor LotsOflines$(a) next
' ----------------------------
'** Mouse Scroll Wheel Demo '** By Brent D. Thorn, 1/2008 '** Updated 10/2009: changed SendMessage to PostMessage '** Released into the PUBLIC DOMAIN
' Trap WM_MOUSEWHEEL messages. hwnd = HWnd( #mnaiuto.editor) Callback lpfnCB, OnMouseWheel( ULong, ULong, ULong, ULong ), Long
CallDLL #wmlib, "SetWMHandler", _ hwnd As ULong, _ 522 As ULong, _ ' WM_MOUSEWHEEL lpfnCB As ULong, _ 0 As Long, _ ret As Long
[wait] ' Must use a Scan loop. Scan CallDLL #kernel32, "Sleep", 100 As Long, ret As Void GoTo [wait]
[quit] ' Must close windows first. ' Then close WMLiberty. Close #wmlib Close #mnaiuto End
Function OnMouseWheel( hWnd, uMsg, wParam, lParam ) ' Callback function to process WM_MOUSEWHEEL messages.
SCROLL.FAST = 0 ' Set to nonzero for faster scrolling.
delta = GET.WHEEL.DELTA.WPARAM(wParam) / 120
If delta > 0 Then ' scroll up If SCROLL.FAST = 0 _ Then cmd = _SB_LINEUP _' slow Else cmd = _SB_PAGEUP ' fast Else ' scroll down If SCROLL.FAST = 0 _ Then cmd = _SB_LINEDOWN _' slow Else cmd = _SB_PAGEDOWN ' fast End If
' Make window believe we clicked its scroll bar. For i = 1 To Abs(delta) CallDLL #user32, "PostMessageA", _ hWnd As ULong, _ _WM_VSCROLL As ULong, _ cmd As ULong, _ 0 As ULong, _ ret As Long
CallDLL #user32, "PostMessageA", _ hWnd As ULong, _ _WM_VSCROLL As ULong, _ _SB_ENDSCROLL As ULong, _ 0 As ULong, _ ret As Long Next End Function
Function GET.WHEEL.DELTA.WPARAM( wParam ) delta = Int((wParam And 4294901760) / 65536) If delta > 32767 Then delta = delta - 65536 GET.WHEEL.DELTA.WPARAM = delta End Function
|
|
walt
New Member
Posts: 5
|
Post by walt on Aug 6, 2018 15:43:00 GMT -5
Thanks for your reply, workaround, and links to more discussion. At least I know it's not me! I might experiment with the workaround when time permits (not right now). Thanks - Walt
|
|