Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Very Simple GUI
#75
Here is 3 Digit Color Picker I was talking about yesterday, run this file along side upcoming Control Designer Form for 3 digit colors 1000 colors. In screenshot I found closest pure green that matched Pic Box Title BC.
Code: (Select All)
Option _Explicit
'$include:'vs GUI.BI'
'   Set Globals from BI              your Title here VVV
Xmax = 400: Ymax = 540: GuiTitle$ = "3 Digit Color Picker"
OpenWindow Xmax, Ymax, GuiTitle$ ' need to do this before drawing anything from NewControls
' GUI Controls
'                     Dim and set Globals for GUI app
Dim Shared As Long lblC, TBC, btnC, picC, btnR0, btnG0, btnB0, btnRP, btnGP, btnBP, btnRM, btnGM, btnBM
Dim Shared As Long btnR9, btnG9, btnB9, btnR5, btnG5, btnB5

lblC = NewControl(4, 10, 20, 200, 32, "3 Digit Color:")
TBC = NewControl(2, 220, 20, 50, 32, "000")
btnC = NewControl(1, 290, 20, 100, 32, "Color")

picC = NewControl(5, 10, 70, 380, 200, "Color Sample")

btnR0 = NewControl(1, 30, 290, 100, 32, "Red 0")
btnG0 = NewControl(1, 150, 290, 100, 32, "Green 0")
btnB0 = NewControl(1, 270, 290, 100, 32, "Blue 0")

btnR5 = NewControl(1, 30, 340, 100, 32, "Red 5")
btnG5 = NewControl(1, 150, 340, 100, 32, "Green 5")
btnB5 = NewControl(1, 270, 340, 100, 32, "Blue 5")

btnR9 = NewControl(1, 30, 390, 100, 32, "Red 9")
btnG9 = NewControl(1, 150, 390, 100, 32, "Green 9")
btnB9 = NewControl(1, 270, 390, 100, 32, "Blue 9")

btnRP = NewControl(1, 30, 440, 100, 32, "Red +1")
btnGP = NewControl(1, 150, 440, 100, 32, "Green +1")
btnBP = NewControl(1, 270, 440, 100, 32, "Blue +1")

btnRM = NewControl(1, 30, 490, 100, 32, "Red -1")
btnGM = NewControl(1, 150, 490, 100, 32, "Green -1")
btnBM = NewControl(1, 270, 490, 100, 32, "Blue -1")

' End GUI Controls

Dim Shared As _Unsigned Long SampleC

MainRouter ' after all controls setup

Sub BtnClickEvent (i As Long)
    Dim t3$
    Select Case i
        Case btnC ' update Color Sample from TB text
            SampleC = c3S~&(con(TBC).Text)
            _Dest con(picC).N1
            Color , SampleC
            Cls
            _Dest 0
            drwPic picC, 0
        Case btnR0
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 1, 1) = "0"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnG0
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 2, 1) = "0"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnB0
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 3, 1) = "0"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnRP
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            If Val(Mid$(t3$, 1, 1)) < 9 Then
                Mid$(t3$, 1, 1) = _Trim$(Str$(Val(Mid$(t3$, 1, 1)) + 1))
                con(TBC).Text = t3$
                drwTB TBC, 0
                BtnClickEvent btnC
            End If
        Case btnRM
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            If Val(Mid$(t3$, 1, 1)) > 0 Then
                Mid$(t3$, 1, 1) = _Trim$(Str$(Val(Mid$(t3$, 1, 1)) - 1))
                con(TBC).Text = t3$
                drwTB TBC, 0
                BtnClickEvent btnC
            End If
        Case btnGP
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            If Val(Mid$(t3$, 2, 1)) < 9 Then
                Mid$(t3$, 2, 1) = _Trim$(Str$(Val(Mid$(t3$, 2, 1)) + 1))
                con(TBC).Text = t3$
                drwTB TBC, 0
                BtnClickEvent btnC
            End If
        Case btnGM
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            If Val(Mid$(t3$, 2, 1)) > 0 Then
                Mid$(t3$, 2, 1) = _Trim$(Str$(Val(Mid$(t3$, 2, 1)) - 1))
                con(TBC).Text = t3$
                drwTB TBC, 0
                BtnClickEvent btnC
            End If
        Case btnBP
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            If Val(Mid$(t3$, 3, 1)) < 9 Then
                Mid$(t3$, 3, 1) = _Trim$(Str$(Val(Mid$(t3$, 3, 1)) + 1))
                con(TBC).Text = t3$
                drwTB TBC, 0
                BtnClickEvent btnC
            End If
        Case btnBM
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            If Val(Mid$(t3$, 3, 1)) > 0 Then
                Mid$(t3$, 3, 1) = _Trim$(Str$(Val(Mid$(t3$, 3, 1)) - 1))
                con(TBC).Text = t3$
                drwTB TBC, 0
                BtnClickEvent btnC
            End If
        Case btnR9
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 1, 1) = "9"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnG9
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 2, 1) = "9"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnB9
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 3, 1) = "9"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnR5
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 1, 1) = "5"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnG5
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 2, 1) = "5"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
        Case btnB5
            t3$ = Right$("000" + _Trim$(con(TBC).Text), 3) ' make sure we are right size
            Mid$(t3$, 3, 1) = "5"
            con(TBC).Text = t3$
            drwTB TBC, 0
            BtnClickEvent btnC
    End Select
End Sub

Sub LstSelectEvent (control As Long)
    Select Case control
    End Select
End Sub

Sub PicClickEvent (i As Long, Pmx As Long, Pmy As Long)
    Select Case i
    End Select
End Sub

Sub PicFrameUpdate (i As Long)
    Select Case i
    End Select
End Sub

Function c3S~& (digit3$) ' parameter as a string of 3 digits
    Dim s3$
    Dim As Long r, g, b
    s3$ = Right$("000" + digit3$, 3)
    r = Val(Mid$(s3$, 1, 1)): If r Then r = 28 * r + 3
    g = Val(Mid$(s3$, 2, 1)): If g Then g = 28 * g + 3
    b = Val(Mid$(s3$, 3, 1)): If b Then b = 28 * b + 3
    c3S~& = _RGB32(r, g, b)
End Function

' not used in this app but is c3s~& partner in Coloring from 3 digits
Function c3I~& (i As Long) 'parameter as an integer up 0-999 noi red until 3rd digit!
    Dim s3$
    Dim As Long r, g, b
    s3$ = Right$("000" + _Trim$(Str$(i)), 3)
    r = Val(Mid$(s3$, 1, 1)): If r Then r = 28 * r + 3
    g = Val(Mid$(s3$, 2, 1)): If g Then g = 28 * g + 3
    b = Val(Mid$(s3$, 3, 1)): If b Then b = 28 * b + 3
    c3I~& = _RGB32(r, g, b)
End Function


'$include:'vs GUI.BM'

   


Attached Files
.zip   3 Digit Color System.zip (Size: 41.16 KB / Downloads: 43)
b = b + ...
Reply


Messages In This Thread
Very Simple GUI - by bplus - 06-14-2022, 04:15 AM
RE: Very Simple GUI - by vince - 06-14-2022, 04:17 AM
RE: Very Simple GUI - by James D Jarvis - 06-14-2022, 04:26 AM
RE: Very Simple GUI - by bplus - 06-14-2022, 04:35 AM
RE: Very Simple GUI - by johnno56 - 06-14-2022, 05:42 AM
RE: Very Simple GUI - by Coolman - 06-14-2022, 08:21 AM
RE: Very Simple GUI - by RNBW - 06-14-2022, 09:50 AM
RE: Very Simple GUI - by Pete - 06-14-2022, 10:32 AM
RE: Very Simple GUI - by bplus - 06-14-2022, 02:32 PM
RE: Very Simple GUI - by Pete - 06-14-2022, 04:33 PM
RE: Very Simple GUI - by bplus - 06-15-2022, 01:45 PM
RE: Very Simple GUI - by bplus - 06-15-2022, 04:39 PM
RE: Very Simple GUI - by Coolman - 06-15-2022, 05:01 PM
RE: Very Simple GUI - by bplus - 06-15-2022, 05:04 PM
RE: Very Simple GUI - by Coolman - 06-15-2022, 06:38 PM
RE: Very Simple GUI - by Kernelpanic - 06-15-2022, 08:51 PM
RE: Very Simple GUI - by bplus - 06-15-2022, 09:00 PM
RE: Very Simple GUI - by Kernelpanic - 06-15-2022, 10:44 PM
RE: Very Simple GUI - by Kernelpanic - 06-15-2022, 10:54 PM
RE: Very Simple GUI - by bplus - 06-16-2022, 01:10 AM
RE: Very Simple GUI - by bplus - 06-16-2022, 05:28 AM
RE: Very Simple GUI - by RNBW - 06-16-2022, 11:31 AM
RE: Very Simple GUI - by RNBW - 06-16-2022, 11:36 AM
RE: Very Simple GUI - by bplus - 06-16-2022, 04:02 PM
RE: Very Simple GUI - by RNBW - 06-16-2022, 06:27 PM
RE: Very Simple GUI - by RNBW - 06-16-2022, 06:54 PM
RE: Very Simple GUI - by Coolman - 06-16-2022, 10:09 PM
RE: Very Simple GUI - by RNBW - 06-17-2022, 10:55 AM
RE: Very Simple GUI - by bplus - 06-17-2022, 01:54 AM
RE: Very Simple GUI - by Coolman - 06-17-2022, 09:03 AM
RE: Very Simple GUI - by bplus - 06-17-2022, 12:35 PM
RE: Very Simple GUI - by Coolman - 06-17-2022, 01:59 PM
RE: Very Simple GUI - by RNBW - 06-17-2022, 11:17 AM
RE: Very Simple GUI - by Kernelpanic - 06-17-2022, 12:35 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 12:55 PM
RE: Very Simple GUI - by RNBW - 06-17-2022, 02:36 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 02:47 PM
RE: Very Simple GUI - by Kernelpanic - 06-17-2022, 02:53 PM
RE: Very Simple GUI - by Kernelpanic - 06-17-2022, 12:42 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 12:42 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 01:38 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 02:22 PM
RE: Very Simple GUI - by Kernelpanic - 06-17-2022, 02:46 PM
RE: Very Simple GUI - by Coolman - 06-17-2022, 02:56 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 03:04 PM
RE: Very Simple GUI - by Kernelpanic - 06-17-2022, 03:15 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 03:17 PM
RE: Very Simple GUI - by Kernelpanic - 06-17-2022, 06:31 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 07:53 PM
RE: Very Simple GUI - by bplus - 06-17-2022, 08:08 PM
RE: Very Simple GUI - by Dav - 06-19-2022, 01:36 AM
RE: Very Simple GUI - by bplus - 06-19-2022, 02:02 AM
RE: Very Simple GUI - by Kernelpanic - 06-19-2022, 10:51 PM
RE: Very Simple GUI - by bplus - 06-19-2022, 07:55 PM
RE: Very Simple GUI - by bplus - 06-20-2022, 05:17 AM
RE: Very Simple GUI - by Coolman - 06-20-2022, 10:58 AM
RE: Very Simple GUI - by bplus - 06-20-2022, 04:36 PM
RE: Very Simple GUI - by bplus - 06-20-2022, 06:24 PM
RE: Very Simple GUI - by bplus - 06-20-2022, 06:50 PM
RE: Very Simple GUI - by bplus - 06-20-2022, 08:33 PM
RE: Very Simple GUI - by vince - 06-20-2022, 11:39 PM
RE: Very Simple GUI - by bplus - 06-21-2022, 04:36 PM
RE: Very Simple GUI - by bplus - 06-22-2022, 01:01 PM
RE: Very Simple GUI - by bplus - 06-22-2022, 10:27 PM
RE: Very Simple GUI - by bplus - 06-23-2022, 11:05 AM
RE: Very Simple GUI - by bplus - 06-26-2022, 01:44 AM
RE: Very Simple GUI - by bplus - 06-26-2022, 10:53 PM
RE: Very Simple GUI - by aurel - 06-27-2022, 06:17 AM
RE: Very Simple GUI - by bplus - 06-27-2022, 10:39 AM
RE: Very Simple GUI - by RNBW - 06-27-2022, 11:10 AM
RE: Very Simple GUI - by bplus - 06-28-2022, 02:27 AM
RE: Very Simple GUI - by bplus - 06-29-2022, 03:56 PM
RE: Very Simple GUI - by Coolman - 06-29-2022, 05:03 PM
RE: Very Simple GUI - by bplus - 06-29-2022, 05:22 PM
RE: Very Simple GUI - by bplus - 06-30-2022, 01:46 PM
RE: Very Simple GUI - by bplus - 06-30-2022, 01:52 PM
RE: Very Simple GUI - by bplus - 06-30-2022, 06:35 PM
RE: Very Simple GUI - by bplus - 06-30-2022, 06:51 PM
RE: Very Simple GUI - by Kernelpanic - 06-30-2022, 09:41 PM
RE: Very Simple GUI - by bplus - 07-01-2022, 10:20 PM
RE: Very Simple GUI - by vince - 07-01-2022, 10:24 PM
RE: Very Simple GUI - by bplus - 07-02-2022, 04:26 PM
RE: Very Simple GUI - by Kernelpanic - 07-02-2022, 05:24 PM
RE: Very Simple GUI - by bplus - 07-02-2022, 06:05 PM
RE: Very Simple GUI - by Kernelpanic - 07-02-2022, 06:19 PM
RE: Very Simple GUI - by bplus - 07-02-2022, 06:23 PM
RE: Very Simple GUI - by Kernelpanic - 07-02-2022, 06:33 PM
RE: Very Simple GUI - by bplus - 07-06-2022, 09:08 PM
RE: Very Simple GUI - by Kernelpanic - 07-07-2022, 03:20 PM
RE: Very Simple GUI - by bplus - 07-12-2022, 02:39 AM
RE: Very Simple GUI - by jjharley - 07-19-2022, 03:38 PM
RE: Very Simple GUI - by bplus - 07-19-2022, 04:08 PM
RE: Very Simple GUI - by vince - 04-25-2023, 03:10 AM
RE: Very Simple GUI - by bplus - 04-25-2023, 03:39 AM
RE: Very Simple GUI - by bplus - 04-25-2023, 04:00 PM
RE: Very Simple GUI - by vince - 04-25-2023, 09:02 PM
RE: Very Simple GUI - by bplus - 04-25-2023, 10:30 PM



Users browsing this thread: 5 Guest(s)