using the clipboard for communicatign between programs
#14
added a color picker to the clipdoodle program above.

compile as colorpick16.exe
Code: (Select All)
'colorpick16
'
'a color picker for mode 0 screens.
'
Screen _NewImage(32, 8, 0)
_ScreenMove 600, 400
_Title "colorpick16"
For y = 0 To 1
    For x = 0 To 7
        fk = y * 8 + x
        p$ = "[  ]"
        a$ = _Trim$(Str$(fk))
        If Len(a$) = 1 Then
            Mid$(p$, 3, 1) = a$
        Else
            Mid$(p$, 2, 2) = a$
        End If
        Color fk, 0
        If fk = 0 Then Color 0, 7
        _PrintString ((x + 1) * 4 - 3, y + 1), p$
    Next
Next
_PrintString (1, 4), "Foreground"
_PrintString (1, 5), "Background"
For x = 0 To 7
    bk = x
    p$ = "[  ]"
    a$ = _Trim$(Str$(bk))
    Mid$(p$, 3, 1) = a$
    Color 0, bk
    If bk = 0 Then Color 15, 0
    _PrintString ((x + 1) * 4 - 3, 7), p$
Next
fk = 15: bk = 0
Do
    _Limit 100
    Do While _MouseInput 'mouse status changes only
        x = _MouseX
        y = _MouseY
        If _MouseButton(1) Then
            If y >= 1 And y <= 2 Then
                fk = (y - 1) * 8 + Int(x / 4)
            End If
            Color fk, 0
            If fk = 0 Then Color fk, 8
            _PrintString (12, 4), "    "
            _PrintString (12, 4), Str$(fk)
            If y = 7 Then
                bk = Int(x / 4)
            End If
            Color fk, bk
            _PrintString (12, 5), "    "
            _PrintString (12, 5), Str$(bk)
            _Clipboard$ = "CK" + _Trim$(Str$(fk)) + "/" + _Trim$(Str$(bk))
        End If
    Loop
    kk$ = InKey$
    ccheck$ = _Clipboard$
    If ccheck$ = "QUITCOLORPICK16" Then kk$ = "QUITCOLORPICK16"
Loop Until kk$ = Chr$(27) Or kk$ = "QUITCOLORPICK16"
_Clipboard$ = "pickcolor quit"

System


This will enable the user to change foreground and background colors in the clipdoodle sample posted earlier.
Reply


Messages In This Thread
RE: using the clipboard for communicatign between programs - by James D Jarvis - 10-24-2022, 04:04 PM



Users browsing this thread: 1 Guest(s)