Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFileDIalog$() and MouseButton(1)
#9
Ok I Fantomas has better solution that does not require extra click of mouse.

Here is another, just move that delay to right after lb is detected from original post!
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$(_MouseButton(1))

    ' 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)

IMO this one is BETTER! because you avoid a 2nd Mouse Input loop.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
RE: _OpenFileDIalog$() and MouseButton(1) - by bplus - 02-13-2026, 01:37 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)