Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CheckBox Logic

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Jan 07, 2017 8:43 am    Post subject: CheckBox Logic Reply with quote

Hi guys,

Code:
function change()
fnC= getProperty(UDF1.CELabel1 , "Font")
if checkbox_getState(UDF1.CECheckbox1)== 1 then
   setProperty(fnC, "Style", "[fsItalic]")
else
   setProperty(fnC , "Style", "[]")
end
return true
end

UDF1.CECheckbox1.onChange = change


With function above :
-- checkbox checked --> Font on CELabel1 style go to ITALIC
-- checkbox unchecked --> Font on CELabel1 style go normal

Now :

Code:
function change()
fnC= getProperty(UDF1.CELabel1 , "Font")
if checkbox_getState(UDF1.CECheckbox1)== 1 then
   setProperty(fnC, "Style", "[fsItalic]")
else
   setProperty(fnC , "Style", "[]")
end
return true
end

function change1()
fnD= getProperty(UDF1.CELabel1 , "Font")
if checkbox_getState(UDF1.CECheckbox2)== 1 then
   setProperty(fnD, "Style", "[fsBold]")
else
   setProperty(fnD , "Style", "[]")
end
return true
end

UDF1.CECheckbox1.onChange = change
UDF1.CECheckbox2.onChange = change1


when two checkBox checked or unchecked, it's make CELabel1 font style going to BOLD, no ITALIC.

How to make CELabel1 font style ITALIC and or BOLD as like on/off function with correct order when check boxes check / uncheck ?
Thank you for helps...
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Jan 07, 2017 9:37 am    Post subject: Reply with quote

Let Dark Byte worry about his own crummy string format. Smile
Code:
function CECheckbox1Click(sender)
  local font = UDF1.CELabel1.Font
  if sender.Checked then
    font.Style = font.Style .. "fsBold"
  else
    font.Style = string.gsub(font.Style, "fsBold", "")
  end
end
function CECheckbox2Click(sender)
  local font = UDF1.CELabel1.Font
  if sender.Checked then
    font.Style = font.Style .. "fsItalic"
  else
    font.Style = string.gsub(font.Style, "fsItalic", "")
  end
end
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Jan 07, 2017 7:55 pm    Post subject: Reply with quote

Hehehe...Thank Zanzer, Sir....
for DB crummy string format..... Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites