View previous topic :: View next topic |
Author |
Message |
Pitronic How do I cheat? Reputation: 0
Joined: 11 Aug 2022 Posts: 2
|
Posted: Thu Aug 11, 2022 2:01 pm Post subject: Changing the color of checkboxes |
|
|
I have a question. When creating a form on UDF1 with checkboxes. What can be added to lua so that the checkbox changes colors if the checkbox is checked, the checkbox color is red, and if not, the checkbox color is black by default, so that the activation deactivation functions look more beautiful.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Fri Aug 12, 2022 3:06 am Post subject: |
|
|
checkboxes can't have a custom color (it's determined by the windows theme)
but if you really need it you can always draw a checkbox yourself. e.g a paintbox that responds to clicks so you can update the state on clicks
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Fri Aug 12, 2022 11:02 am Post subject: |
|
|
Simple idea. You can add color to it.
Note: I used the Checkbox "Click" event in the effect. Reusing the Click event outside.
I'm releasing the "Change" thing to the outside and you.
Code: | function chkbox_effect(chk,lbl,clr1,clr2,text1,text2)
chk.AutoSize=false
chk.Caption=""
chk.Checked=false
lbl.Left=chk.Left + 15
lbl.Top=chk.Top + 1
lbl.Font.Color = clr1
lbl.Font.Style="fsBold"
lbl.Font.Size=12
lbl.caption=text1
chk.Height=lbl.Height + 4
chk.Width=lbl.Width + 15
--lbl.Color=0xffffff
chk.OnClick=function()
if chk.Checked==true then
lbl.Font.Color = clr2
lbl.caption=text2
else
lbl.Font.Color = clr1
lbl.caption=text1
end
end
end
if frm1 then frm1.Destroy() frm1=nil end
frm1 = createForm()
ChkBox1 = createCheckBox(frm1) ChkBox1.AutoSize=false
ChkBox1.Left = 30 ChkBox1.Top = 30
ChkBox2 = createCheckBox(frm1) ChkBox2.AutoSize=false
ChkBox2.Left = 30 ChkBox2.Top = 55
Lbl1 = createLabel(frm1)
Lbl2 = createLabel(frm1)
chkbox_effect(ChkBox1,Lbl1,0x000000,0x0000ff,"Hack Deactive","Hack Active")
chkbox_effect(ChkBox2,Lbl2,0x000000,0x0000ff,"Hack Deactive","Hack Active")
ChkBox1.OnChange=function()
if ChkBox1.Checked==true then
print("Hack 1 Active!")
else
print("Hack 1 DeActive!")
end
end
ChkBox2.OnChange=function()
if ChkBox2.Checked==true then
print("Hack 2 Active!")
else
print("Hack 2 DeActive!")
end
end
-- use UDF1 or your Trainer Name and control name ..
--chkbox_effect(UDF1.CECheckbox1,UDF1_CELabel1,0x000000,0x0000ff,"Hack Deactive","Hack Active")
--chkbox_effect(UDF1.CECheckbox2,UDF1_CELabel2,0x000000,0x0000ff,"Hack Deactive","Hack Active") |
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat Aug 13, 2022 9:28 pm Post subject: |
|
|
Or like this
Code: | local red=858083
local green=32768
if f then f.destroy() end
f=createForm()
chk1=createCheckBox(f)
chk1.font.size=14
chk1.left = 30
chk1.top = 30
chk1.caption='This is OFF'
executeCodeLocalEx('uxtheme.SetWindowTheme', chk1.handle, "", "")
chk1.font.color = red
chk2=createCheckBox(f)
chk2.font.size=14
chk2.left = 30
chk2.top = 70
chk2.caption='This is OFF'
executeCodeLocalEx('uxtheme.SetWindowTheme', chk2.handle, "", "")
chk2.color = red
chk2.font.color=0xffffff
function chk1_tickChange()
if chk1.Checked == true then
chk1.caption='This is ON'
chk1.font.color=green
else
chk1.caption='This is OFF'
chk1.font.color=red
end
end
function chk2_tickChange()
if chk2.Checked == true then
chk2.caption='This is ON'
chk2.color = green
chk2.font.color=0xffffff
else
chk2.caption='This is OFF'
chk2.color = red
chk2.font.color=0xffffff
end
end
f.Show()
chk1.OnChange=chk1_tickChange
chk2.OnChange=chk2_tickChange |
Anyhow I am not find how to change check box color / check mark color in win API yet.
or check for user32 properties to quick change windows theme
Description: |
|
Filesize: |
16.89 KB |
Viewed: |
2330 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Sun Aug 14, 2022 7:09 am Post subject: |
|
|
Corroder wrote: | Or like this
executeCodeLocalEx('uxtheme.SetWindowTheme', chk2.handle, "", "") |
I give up. Your code is more original.
This might give @DB a different idea in the new update.
You can share this in the Lua section. (for archive)
and +1
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon Aug 15, 2022 11:45 pm Post subject: |
|
|
Don't give up...
This is a sample using uxtheme for some properties on CE Form
Code: | function ActivateWindowTheme(hWnd, pszSubAppName, pszSubIdList)
return executeCodeLocalEx('uxtheme.SetWindowTheme', hWnd, pszSubAppName, pszSubIdList)
end
if frm then frm.destroy() end
frm = createForm()
btn1 = createButton(frm)
btn1.setSize(100,50)
btn1.setPosition(10,10)
btn1.Caption = 'Original CE'
btn2 = createButton(frm)
btn2.setSize(100,50)
btn2.setPosition(120,10)
btn2.Caption = 'To UxTheme'
ActivateWindowTheme(btn2.handle,"BUTTON","")
cb1 = createCheckBox(frm)
cb1.setPosition(10,70)
cb1.Caption = 'Original'
cb2 = createCheckBox(frm)
cb2.setPosition(10,100)
cb2.Caption = 'UxTheme'
ActivateWindowTheme(cb2.handle,"CHECKBOX","")
cb3 = createCheckBox(frm)
cb3.setPosition(10,130)
cb3.Caption = 'UxTheme With Color'
ActivateWindowTheme(cb3.handle,"CHECKBOX","")
cb3.Color = 54852
cb3.Font.Color = 0xffffff
frm.show() |
See the different ?
Description: |
|
Filesize: |
18.54 KB |
Viewed: |
2260 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue Aug 16, 2022 1:50 am Post subject: |
|
|
I really recommend to just use ownerdraw checkboxes and draw the boxes and text the way you like. (try window subclassing checkbox if you wish)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Tue Aug 16, 2022 5:45 am Post subject: |
|
|
Dark Byte wrote: | ... (try window subclassing checkbox if you wish) |
Yes, I see. Anyhow I don't have any experiences to write window subclassing in CE Lua and of course to manage the event handler for the control.
Btw, this is a subclassing project using Lua WINAPI.
And thanks DB for your recommendation.
https://github.com/luapower/winapi/blob/master/winapi/checkboxclass.lua?ts=3
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 54
Joined: 01 Oct 2008 Posts: 941
|
Posted: Tue Aug 16, 2022 9:08 am Post subject: |
|
|
That's for luajit, interfacing windows api via its ffi.
May be this https://github.com/stevedonovan/winapi , but it's 9 yr old (b4 5.3?), not sure if it can build with ce, or if there're updated version.
_________________
- Retarded. |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Fri Aug 19, 2022 1:46 am Post subject: |
|
|
The magic of "setWindowTheme" still remains. One line of code and good result. With just this code, a library can be created for other objects and different visuals can be given in existing gui controls.
Code: |
if f then f.destroy() end
f=createForm()
chk1=createCheckBox(f)
chk1.font.size=14
chk1.left = 30
chk1.top = 30
chk1.caption='This is OFF'
executeCodeLocalEx('uxtheme.SetWindowTheme', chk1.handle, "", "")
executeCodeLocalEx('uxtheme.SetWindowTheme', f.handle, "", "")
f.color = 0x00ff00
f.font.color = 0xff0000
chk1.font.color = 0x0000ff
|
_________________
|
|
Back to top |
|
|
|