|
Post by angelo2449 on Jun 15, 2018 3:37:20 GMT -5
Hy Guys,
I wrote code that involves the use of 'Texteditor', the command works perfectly, even the mouse scroll in the basic environment, after compiling the mouse scroll does not work. Thnk you
|
|
|
Post by Carl Gundel on Jun 15, 2018 7:00:09 GMT -5
Hy Guys, I wrote code that involves the use of 'Texteditor', the command works perfectly, even the mouse scroll in the basic environment, after compiling the mouse scroll does not work. Thnk you Hi, What version of Liberty BASIC are you using?
|
|
|
Post by Rod on Jun 15, 2018 15:41:10 GMT -5
Are we discussing the middle mousebutton scroll?
|
|
|
Post by metro on Jun 15, 2018 21:48:07 GMT -5
My testing using this code
'Form created with the help of Freeform 3 v07-15-08 'Generated on Jun 16, 2018 at 10:38:38
[setup.main.Window]
'-----Begin code for #main
nomainwin WindowWidth = 550 WindowHeight = 410 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
TexteditorColor$ = "white" texteditor #main.textedit1, 5, 5, 100, 100
'-----End GUI objects code
'-----Begin menu code
menu #main, "Edit" ' <-- Texteditor menu.
'-----End menu code
open "untitled" for window as #main print #main, "font ms_sans_serif 10" print #main, "trapclose [quit.main]"
[main.inputLoop] 'wait here for input event wait
[quit.main] 'End the program close #main end
middle mousebutton scroll works in development environment correctly using: LB_Pro_4.04 ; LB4.50 ; LB4.5.1 ; LB_Pro_4.5.1 but when I create an "exe", middle mousebutton scroll will only work using LB_Pro_4.04 I no longer have the standard version of 4.04 installed to test
|
|
|
Post by angelo2449 on Jun 16, 2018 6:18:15 GMT -5
HY
I use Liberty Basic Release 4.5.1
Yes, is the middle mousebutton scroll
|
|
|
Post by Rod on Jun 17, 2018 3:56:35 GMT -5
The texteditor is a widget built to look like a windows control, it does not currently support middle mouse scroll messages. Carl would need to explain more. There is a work round but I would not recommend it to you, it is complex.
'** Mouse Scroll Wheel Demo '** By Brent D. Thorn, 1/2008 '** Updated 10/2009: changed SendMessage to PostMessage '** Released into the PUBLIC DOMAIN
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
' Open main window. Open "Mouse Wheel Demo" For Graphics As #demo
#demo "TrapClose [quit]" #demo "SetFocus"
' Draw something on it. #demo "Down; Place 8 0;\" For lin = 1 to 50 #demo "\";lin Next #demo "Flush"
' Trap WM_MOUSEWHEEL messages. hwnd = HWnd(#demo) 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. Close #demo
' Then close WMLiberty. Close #wmlib
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
It is great code if you do want and MUST have middle mouse scroll handled, but for a text editor do you really need it?
|
|
|
Post by angelo2449 on Jun 17, 2018 4:59:28 GMT -5
I can do without the scroll, I just wanted to know the reason why it works in the LB environment and not in the WINDOWS 10 environment. Thank You, Angelo 2449
|
|
|
Post by metro on Jun 17, 2018 6:14:35 GMT -5
I'm curious, has anyone else tried middle mousebutton scroll in a program compiled using LB4.04 Pro I find it works as I expect it should under Win10 and Wine on Mint Linux 18.3 64bit Of course there has to be more than one line of text before it will scroll, and the mouse pointer has to be positioned within the editor! The other versions of LB I have complied the same code (see below) and the scroll does not work. www.dropbox.com/sh/mry6gc5imz24xqg/AABnrDuySpg4IpAzjlbS1C7ua?dl=0
|
|
|
Post by tsh73 on Jun 17, 2018 15:13:45 GMT -5
Just to say in 4.5.1 under XP - works under IDE - works if TKN run through IDE (menu Run/Run *.TKN File) - doesn't run if TKN run via run451.exe
|
|
|
Post by angelo2449 on Jun 18, 2018 11:41:17 GMT -5
I tried MyEditor.exe and the scroll works! What happened? Thank you
|
|
cundo
Full Member
Muchas Gracias!!
Posts: 146
|
Post by cundo on Jun 18, 2018 12:18:54 GMT -5
Just to say in 4.5.1 under XP - works under IDE - works if TKN run through IDE (menu Run/Run *.TKN File) - doesn't run if TKN run via run451.exe As I understand, the LB IDE has its own interpreter embedded, so there are differences between the two.
|
|
|
Post by angelo2449 on Jun 18, 2018 13:22:45 GMT -5
I'm sending you my code, maybe this behavior depends on the fact that it loads the text from a file
' @MIF
[Main.Info]
BackgroundColor$ = "blue" ForegroundColor$ = "blue" TexteditorColor$ = "white"
WindowWidth = 1090 WindowHeight = 700
UpperLeftX = 200 UpperLeftY = 100
button #mnaiuto.st, "Stampa", [StampaInfo], 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 [mnaiuto.Esci]" #mnaiuto.editor, "!enable"
select case Aiuto$
case "Main" open Disco$ + "\Trasformer\Info\InfoUno.txt" for input as #1
end select
i = 0 while eof(#1) = 0 i = i + 1 line input #1, text$ #mnaiuto.editor, " "; text$ wend close #1
#mnaiuto.editor, "!origin 1 1"
wait
' ----------------------------
[mnaiuto.Esci]
NonChiudere = 0 Stato$ = "Main" close #mnaiuto Info = 0 wait
' ----------------------------
Thank You
|
|
|
Post by metro on Jun 18, 2018 18:17:51 GMT -5
|
|
|
Post by Carl Gundel on Jun 19, 2018 8:33:34 GMT -5
Seems like a bug in the runtime engine EXE. Sorry about that.
|
|
|
Post by metro on Jun 20, 2018 6:17:36 GMT -5
Thanks Carl, do you have time to look at a resolving this or do we wait for the next upgrade
metro
|
|