View previous topic :: View next topic |
Author |
Message |
LastExceed Expert Cheater Reputation: 1
Joined: 05 Nov 2014 Posts: 130
|
Posted: Sat Oct 31, 2015 3:04 pm Post subject: How do I properly gray out buttons ect? |
|
|
Let's say I have 2 Buttons called CEButtonGrayout and CEButtonRestore and a text field (is that how you call it?) called CEEditHP.
Code: | function CEButtonGrayoutClick(sender)
setProperty(UDF1.CEEditHP,"Enabled", False)
end
function CEButtonRestoreClick(sender)
setProperty(UDF1.CEEditHP,"Enabled", True)
end
|
If I now press the grayout button the text field gets grayed out as it should. But pressing the restore button afterwards doesn't revert the change.
Even more weird is the fact that if I press the restore button without having pressed the grayout button before, it grays out the text flied although it's the exact opposite of what it should do. Am I doing something wrong or is that a bug?
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Oct 31, 2015 3:10 pm Post subject: |
|
|
Launch "Lua Engine" window and paste this and click "Execute"
Code: | return type(True), type(False), type(true), type(false) |
Then try this:
Code: | return tostring(True), tostring(False), tostring(true), tostring(false) |
I've got this:
Code: | return type(True), type(False), type(true), type(false)
:nil
:nil
:boolean
:boolean
return tostring(True), tostring(False), tostring(true), tostring(false)
:nil
:nil
:true
:false |
And that means, True is a variable, in this case uninitialized variable, true is a keyword.
Also, properties can be easily accessed since CE6.4:
Code: | function CEButtonGrayoutClick(sender)
UDF1.CEEditHP.Enabled=false
end
function CEButtonRestoreClick(sender)
UDF1.CEEditHP.Enabled=true
end
|
_________________
Last edited by mgr.inz.Player on Sat Oct 31, 2015 3:16 pm; edited 2 times in total |
|
Back to top |
|
|
LastExceed Expert Cheater Reputation: 1
Joined: 05 Nov 2014 Posts: 130
|
Posted: Sat Oct 31, 2015 3:14 pm Post subject: |
|
|
mgr.inz.Player wrote: | Launch Lua engine and paste this and click "Execute"
Code: | return type(True), type(False), type(true), type(false) |
|
Didn't change anything, problem still persists.
Code: |
:nil
:nil
:boolean
:boolean
|
This is the output of the LUA engine. Can you explain what that means (both your code and the output)?
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Oct 31, 2015 3:16 pm Post subject: |
|
|
He's trying to tell you that "True" is not the proper syntax.
"True" is a variable name. The word you want to use is "true".
Lowercase!
|
|
Back to top |
|
|
LastExceed Expert Cheater Reputation: 1
Joined: 05 Nov 2014 Posts: 130
|
Posted: Sat Oct 31, 2015 3:19 pm Post subject: |
|
|
Zanzer wrote: | He's trying to tell you that "True" is not the proper syntax.
"True" is a variable name. The word you want to use is "true".
Lowercase! |
aaaaah, now I get it! A good joke actually, too bad newbies won't understand it.
Anyway thanks for clearing this up, works now
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Oct 31, 2015 3:22 pm Post subject: |
|
|
yeah. Also, you don't need setProperty if you use CE6.4 or newer.
_________________
|
|
Back to top |
|
|
|