Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:04 08 Sep 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : how do fill backtround whit yellow color keep the gui elements

Author Message
tenij000
Regular Member

Joined: 30/05/2025
Location: Netherlands
Posts: 51
Posted: 09:37am 21 Jul 2025
Copy link to clipboard 
Print this post

how do i fill the background in yellow color keep the gui elements




GUI SETUP 1

GUI BUTTON     #25, "CALC",  160, 60, 60, 30, RGB(0,0,0), RGB(0,255,0)

Font 3
GUI SETUP 2


' === Hoofdvelden ===
GUI TEXTBOX    #1,  10,  10, 300, 30, RGB(white), RGB(gray) ' Invoerveld
GUI BUTTON     #2, "DEL", 260, 50, 50, 30, RGB(255,255,255), RGB(255,0,0) ' Verwijder laatste teken
GUI DISPLAYBOX #3, 10, 50, 240, 30, RGB(white), RGB(gray)    ' Resultaat
GUI BUTTON     #4, "=", 205, 195, 60, 30, RGB(0,0,0), RGB(0,255,0)



' === Knoppenrijen (cijfers en operatoren) ===
chars$ = "789/456*123-0.+"
id = 10
x0 = 10 : y0 = 90
w = 60 : h = 30 : m = 5

For i = 1 To Len(chars$)
 cx = ((i - 1) Mod 4)
 cy = Int((i - 1) / 4)
 x = x0 + cx * (w + m)
 y = y0 + cy * (h + m)
 teken$ = Mid$(chars$, i, 1)
 GUI BUTTON #id, teken$, x, y, w, h, RGB(white), RGB(200,200,200)
 id = id + 1
Next

' === Eigen REPLACE functie ===
Function REPLACE$(tekst$, zoek$, vervang$)
 Local p, result$
 result$ = ""
 Do
   p = Instr(tekst$, zoek$)
   If p = 0 Then
     result$ = result$ + tekst$
     Exit Do
   EndIf
   result$ = result$ + Left$(tekst$, p - 1) + vervang$
   tekst$ = Mid$(tekst$, p + Len(zoek$))
 Loop
 REPLACE$ = result$
End Function

' === Hoofdlus ===


Do

text 10,10,""+str$(a)
 ' Bereken knop (#4)
 If CtrlVal(#4) = 1 Then
   expr$ = CtrlVal(#1)
   expr$ = REPLACE$(expr$, " ", "")
   If Left$(expr$,1)="=" Then expr$ = Mid$(expr$,2)
   On ERROR SKIP
   result = Eval(expr$)
   CtrlVal(#3) = Str$(result)
   CtrlVal(#4) = 0
 EndIf

 ' DEL knop (#2)
 If CtrlVal(#2) = 1 Then
   tekst$ = CtrlVal(#1)
   If Len(tekst$) > 0 Then CtrlVal(#1) = Left$(tekst$, Len(tekst$)-1)
   CtrlVal(#2) = 0
 EndIf

 ' Knoppen 10 t/m 24 (invoer)
 For id = 10 To 24
   If CtrlVal(#id) = 1 Then
     toevoeg$ = Mid$(chars$, id - 9, 1)
     CtrlVal(#1) = CtrlVal(#1) + toevoeg$
     CtrlVal(#id) = 0
   EndIf
 Next
 
 ' navigatie knop (#25)
 If CtrlVal(#25) = 1 Then
    CtrlVal(#25) = 0
    gui page 2
 EndIf

 Pause 50
Loop
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2689
Posted: 12:29pm 21 Jul 2025
Copy link to clipboard 
Print this post

Is this what you are after?
CLOUR foreground_colour, RGB(Yellow)
  Quote  COLOUR fore [, back] or COLOR fore [, back]
Sets the default colour for commands (PRINT, etc) that display on the on the attached LCD panel.
'fore' is the foreground colour, 'back' is the background colour.
The background is optional and if not specified will default to black.


Or perhaps start the program with:-

CLS RGB(yellow)

Then add your GUI elements. After closing a GUI element use:-

BOX x, y, w, h, 1, RGB(yellow), RGB(yellow)

To restore yellow to that area.
 
tenij000
Regular Member

Joined: 30/05/2025
Location: Netherlands
Posts: 51
Posted: 10:33pm 21 Jul 2025
Copy link to clipboard 
Print this post

thx
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025