Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFileDIalog$() and MouseButton(1)
#11
Code: (Select All)
i fail to see an use for this.

also in the example just above.  _mousebutton(1) is called twice.  it needs to be restricted to loading the value of lb variable.


So lets see what you came up with Smile  Its really interesting how people come up with different solutions to overcome a problem, getting clear of the mousedown signal without unintentional running a sequence a second time, is one of them.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#12
(02-13-2026, 08:48 PM)bplus Wrote:
Code: (Select All)
i fail to see an use for this.

also in the example just above.  _mousebutton(1) is called twice.  it needs to be restricted to loading the value of lb variable.


So lets see what you came up with Smile  Its really interesting how people come up with different solutions to overcome a problem, getting clear of the mousedown signal without unintentional running a sequence a second time, is one of them.
Tannks bplus and hsiangch_ong for your reply, i use this code with your change (_Delay .1 before OpenFileDialog) and i change _mousebutton(1) by "lb" in _Printstring" but result is -1Delay .1_Delay .1

Code: (Select All)
Screen _NewImage(800, 600, 32)

Do
    Cls
    Line (0, 0)-(799, 599), _RGB32(50, 50, 50), BF

    ' Bouton "Charger"
    Line (300, 250)-Step(200, 50), _RGB32(100, 100, 100), BF
    Line (300, 250)-Step(200, 50), _RGB32(200, 200, 200), B
    Color _RGB32(255, 255, 255)
    _PrintString (350, 268), "CHARGER"

    ' Affichage état
    _PrintString (10, 30), "_MOUSEBUTTON(1) = " + Str$(lb)

    ' Gestion souris
    While _MouseInput: Wend
    mx = _MouseX
    my = _MouseY
    lb = _MouseButton(1)

    ' CLIC sur bouton Charger
    If lb Then

        _Delay .1 ' <<<< get clear of the click FIRST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        If mx >= 300 And mx <= 500 And my >= 250 And my <= 300 Then
            filename$ = _OpenFileDialog$("Load", "", "*.*", "Files", 0)
            '  _Delay 0.1  >>>> move this to the above !!!!!!! line
        End If
    End If

    _Display
    _Limit 60
Loop Until InKey$ = Chr$(27)
Reply
#13
Ok didn't work for me either today. That's odd it WAS working fine for me the other day???

Oh try increasing the delay to .25 or even more! That fixed it for me today.

Update: OK I just rechecked everything again, a delay of .25 fixed it on my system, yours might be good with more or less than .25.

To be sure, say for distribution to everyone's system, you can run a second MouseInput loop check but gosh thats so ugly.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)