| View previous topic :: View next topic |
| Author |
Message |
kucingkembar Advanced Cheater
Reputation: 0
Joined: 08 Oct 2020 Posts: 71
|
Posted: Mon Apr 04, 2022 2:53 am Post subject: create RGB Button Background |
|
|
hi, sorry again for my bad English,
I like to create a button with a background that changes color like the default "select a process to open" button when there no process is selected,
this is the code:
| Code: |
if form1 then form1.Destroy() end
form1 = createForm()
form1.setSize(80, 100)
form1.Position = "poScreenCenter"
form1.Caption = "CE RGB test"
ThePanel = createPanel(form1)
ThePanel.Width = 130
ThePanel.Height = 100
TheButton = createButton(ThePanel)
TheButton.Top = 35
TheButton.Left = 30
TheButton.Caption = "Button"
--loop start
ThePanel.Color = '0x66006600'
ThePanel.Color = '0x00660066'
--loop end
--the rest of the code
|
my problem is; how to make the changing color is an independent or separate process, so the "--the rest of the code" will run without stopping the changing color
thank you for reading, have a nice day
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Mon Apr 04, 2022 5:46 am Post subject: |
|
|
It doesn't fade between colours, but it does at least randomly select a colour and display it:
| Code: |
if form1 then form1.destroy(); form1 = nil end
form1 = createForm()
form1.setSize(80, 100)
form1.Position = "poScreenCenter"
form1.Caption = "CE RGB test"
ThePanel = createPanel(form1)
ThePanel.Width = 130
ThePanel.Height = 100
TheButton = createButton(ThePanel)
TheButton.Top = 35
TheButton.Left = 30
TheButton.Caption = "Button"
if TheTimer then TheTimer.destroy() TheTimer = nil end
TheTimer = createTimer(form1)
TheTimer.Interval = 150
TheTimer.Enabled = true
TheTimer.OnTimer = function()
-- Just select a random colour
local R = math.random(255)
local G = math.random(255)
local B = math.random(255)
ThePanel.Color = string.format("0x00%X", B..G..R)
end
|
|
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Mon Apr 04, 2022 7:53 am Post subject: |
|
|
| i just leave a link only link
|
|
| Back to top |
|
 |
kucingkembar Advanced Cheater
Reputation: 0
Joined: 08 Oct 2020 Posts: 71
|
Posted: Mon Apr 04, 2022 9:58 am Post subject: |
|
|
@LeFiXER
Dude, thank you, why I do not think about put that inside the timer, silly me,
@Frouk
thank you for the link, I tried the Code you provide non-edited, but not work, I think I will study it
|
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Mon Apr 04, 2022 9:59 am Post subject: |
|
|
| kucingkembar wrote: | @LeFiXER
Dude, thank you, why I do not think about put that inside the timer, silly me,
@Frouk
thank you for the link, I tried the Code you provide non-edited, but not work, I think I will study it |
code contains timer
|
|
| Back to top |
|
 |
|