 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Thu Mar 09, 2023 4:27 pm Post subject: Is it possible to change text color of a tab on PageControl? |
|
|
Is it possible to change the text color of a Tab Title on CEPageControl? Name of the tab is located there: TabSheet1. I want to change each Tab Title with a different text color. Example: Text: TabSheet1 to Red, TabSheet2 to Green, TabSheet3 to Blue.
Is it possible to change the background color of a Tab Title, with Canvas/Brush/Rect methods? And change each Tab Title with a different background color.
Last edited by Razi on Thu Mar 09, 2023 8:39 pm; edited 1 time in total |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Thu Mar 09, 2023 5:30 pm Post subject: |
|
|
The change is successful. But the change is not reflected in the image.
Code: | UDF1.TabSheet1.Caption="tab11"
UDF1.TabSheet2.Caption="tab22"
print(UDF1.CEPageControl1.ActivePage.Font.Color)
print(UDF1.CEPageControl1.ActivePage.caption)
UDF1.TabSheet1.Font.Color=121125
UDF1.TabSheet2.Font.Color=421125
print(UDF1.TabSheet1.Font.Color,UDF1.TabSheet1.Caption)
print(UDF1.TabSheet2.Font.Color,UDF1.TabSheet2.Caption) |
If you can't find a way, a rendering code can be made that organizes the Panels for the same task.
_________________
|
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1066 Location: 0x90
|
Posted: Thu Mar 09, 2023 5:31 pm Post subject: |
|
|
It looks like there isn't any colour property for TabSheets available. See ../celua.txt#L3290 for more information about the properties/methods available for the PageControl/TabSheet component.
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Mar 09, 2023 7:51 pm Post subject: |
|
|
Change font color for each tabs.
Code: | if f then f.Destroy() end
f=createForm()
pc=createPageControl(f)
-- Just exceute this code below to set windows theme off and get different looks
--executeCodeLocalEx('uxtheme.SetWindowTheme', pc.Handle, "", "")
t1=pc.addTab()
t1.Caption = "Sheet 1"
t1.ParentFont = false
t1.Font.Color = 0xf00fde
t2=pc.addTab()
t2.Caption= "Sheet 2"
t2.ParentFont = false
t2.Font.Color = 0xff
--- Test the effects for ParentFont = false
lb1 = createLabel(t1)
lb1.Caption = 'Hello Cheat Engine'
lb2 = createLabel(t2)
lb2.Caption = 'Hello Cheat Engine' |
To change Tab Color seem you need draw event for the tabs, but I didn't see CE TabSheet on a Page Control have a Canvas. So, I just think use a rect or panel to replace the tab on their position.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Thu Mar 09, 2023 8:28 pm Post subject: |
|
|
I'm sorry, I phrased it wrong. I want to change the color of Tab Titles (only the Tab Title font color and Tab Title background color, and each tab title with its own color). Without changing the colors on the Tabsheet and any other controls located on the Tabsheet.
(To change color inside of the Tabsheet, we can place a panel in there (align to alClient) and change the panel color).
Last edited by Razi on Fri Mar 10, 2023 7:27 am; edited 1 time in total |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Fri Mar 10, 2023 3:19 am Post subject: |
|
|
I guess you'll have to make some adjustments.
Width and height of current page tab titles (for Panels), starting position (Left) and whatever you want to add.
I know you are considering using panel for page content color.
I'm just giving an idea for the titles.
Here is the code;
Code: | if f1 then f1.Destroy() end
f1=createForm()
pc=createPageControl(f1)
-- Effect Tabs ..
local tabTbl = {}
function addTab1(pnlHnd,tabHnd,name,cpt,clr,idx)
clr1 = 0x00ffff
tabTbl[name]=tabHnd.addTab()
tabTbl[name].Caption = cpt
tabTbl[name].ParentFont = false
tabTbl[name].Font.Color = 0xf00fde
print(tabTbl[name].Width)
tabTbl[name..idx] = createPanel(pnlHnd)
tabTbl[name..idx].Height = 23
tabTbl[name..idx].Width = 68
tabTbl[name..idx].Top = tabHnd.Top
lft = tabTbl[name..idx].Width * tonumber(idx) - tabTbl[name..idx].Width
tabTbl[name..idx].Left = tonumber(lft) + tabHnd.Left
tabTbl[name..idx].Caption = cpt
function changeColor()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr1
else
tabTbl[name..idx].Color = clr
end
end
changeColor()
tabTbl[name..idx].BevelOuter = "bvNone"
tabTbl[name..idx].OnClick = function() tabHnd.ActivePage=tabTbl[name] end
tabTbl[name..idx].OnMouseMove=function()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr1
else
tabTbl[name..idx].Color=clr - 5600
end
end
tabTbl[name..idx].OnMouseLeave=function()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr1
else
tabTbl[name..idx].Color=clr
end
end
tabTbl[name..idx].OnMouseDown=function() tabTbl[name..idx].Color=0x00ffff end
tabTbl[name..idx].OnMouseUp=function()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr1
else
tabTbl[name..idx].Color=clr
end
end
tabTbl[name].OnHide=function() tabTbl[name..idx].Color=clr end
return tabTbl[name]
end
--use effect
myTab1 = addTab1(f1,pc,"myTab1","myTab11",0xff7a00,1)
myTab2 = addTab1(f1,pc,"myTab2","myTab22",0xffff00,2)
--add controls
myTab1.Font.Color = 0xff00ff
lb1 = createLabel(myTab1)
lb1.Caption = 'Hello Cheat Engine'
myTab2.Font.Color = 0x0f00fa
lb2 = createLabel(myTab2)
lb2.Caption = 'Hello Lua'
|
To add more ideas, keep asking and sharing.
_________________
|
|
Back to top |
|
 |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Fri Mar 10, 2023 7:35 am Post subject: |
|
|
AylinCE wrote: | I guess you'll have to make some adjustments.
Width and height of current page tab titles (for Panels), starting position (Left) and whatever you want to add. |
Something like this was what I needed, thanks.
|
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1478
|
Posted: Fri Mar 10, 2023 9:10 am Post subject: |
|
|
My fault, I forgot that.
If you want the tab pages in color and are going to color them with the panel, you'll need to get the page panel instead of the TabSheet to add control to the focus.
Below code will color page title and page color in same category. (As in the original PageControl.)
And all controls (Label, image, edit etc) will be added to Page Panel.
Here is a different code edited:
Code: | if f1 then f1.Destroy() end
f1=createForm()
pc=createPageControl(f1)
-- Effect Tabs ..
local tabTbl = {}
function addTab1(pnlHnd,tabHnd,name,cpt,clr,idx)
clr1 = 0x00ffff
tabTbl[name]=tabHnd.addTab()
tabTbl[name].Caption = cpt
tabTbl[name].ParentFont = false
tabTbl[name].Font.Color = 0xf00fde
--print(tabTbl[name].Width)
tabTbl[name..idx] = createPanel(pnlHnd)
tabTbl[name..idx].Height = 23
tabTbl[name..idx].Width = 68
tabTbl[name..idx].Top = tabHnd.Top
lft = tabTbl[name..idx].Width * tonumber(idx) - tabTbl[name..idx].Width
tabTbl[name..idx].Left = tonumber(lft) + tabHnd.Left
tabTbl[name..idx].Caption = cpt
------------ tab page .. --------------
tabTbl[name..idx*100] = createPanel(tabTbl[name])
tabTbl[name..idx*100].Align = "alClient"
--tabTbl[name..idx*100].Color = clr
--tabTbl[name..idx*100].BevelColor = clr
tabTbl[name..idx*100].BevelOuter = "bvNone"
---------------------------------------
function changeColor()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr
tabTbl[name..idx*100].Color = clr
tabTbl[name..idx*100].BevelColor = clr
else
tabTbl[name..idx].Color = clr
end
end
changeColor()
tabTbl[name..idx].BevelOuter = "bvNone"
tabTbl[name..idx].OnClick = function() tabHnd.ActivePage=tabTbl[name] end
tabTbl[name..idx].OnMouseMove=function()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr
else
tabTbl[name..idx].Color=clr - 6600
end
end
tabTbl[name..idx].OnMouseLeave=function()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr
else
tabTbl[name..idx].Color=clr
end
end
tabTbl[name..idx].OnMouseDown=function() tabTbl[name..idx].Color=0x00ffff end
tabTbl[name..idx].OnMouseUp=function()
if tabHnd.ActivePage==tabTbl[name] then
tabTbl[name..idx].Color=clr
tabTbl[name..idx*100].Color = clr
tabTbl[name..idx*100].BevelColor = clr
else
tabTbl[name..idx].Color=clr
end
end
tabTbl[name].OnHide=function() tabTbl[name..idx].Color=clr end
return tabTbl[name..idx*100]
end
--use effect (return page panel)
myTab1 = addTab1(f1,pc,"myTab1","myTab11",0x00ff00,1)
myTab2 = addTab1(f1,pc,"myTab2","myTab22",0xffff00,2)
--add controls (page panel)
myTab1.Font.Color = 0xff00ff
lb1 = createLabel(myTab1)
lb1.Caption = 'Hello Cheat Engine'
myTab2.Font.Color = 0x0f00fa
lb2 = createLabel(myTab2)
lb2.Caption = 'Hello Lua' |
_________________
|
|
Back to top |
|
 |
Razi Expert Cheater
Reputation: 1
Joined: 17 Jan 2018 Posts: 205
|
Posted: Fri Mar 10, 2023 10:06 am Post subject: |
|
|
thanks for help
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|