Thread: Checkbox issue
-
July 22nd, 2010, 22:19 #1
- Join Date
- Feb 2009
- Location
- Jacksonville, Florida
- Posts
- 153
Checkbox issue
I use this script in my numberfields all the time...
<script>
function onInit()
if not User.isHost() then
setReadOnly(true);
end
end
</script>
However I want to toss the same effect into a few checkboxes. But when I put the script in, it makes the checkbox disappear :\
Any advice?
<checkbox name="deathmagic">
<anchored>
<left>
<anchor>left</anchor>
<offset>405</offset>
</left>
<top>
<anchor>top</anchor>
<offset>640</offset>
</top>
<size>
<width>15</width>
<height>15</height>
</size>
</anchored>
<stateicons>
<on>indicator_checkon</on>
<off>indicator_checkoff</off>
</stateicons>
<script>
function onInit()
if not User.isHost() then
setReadOnly(true);
end
end
</script>
</checkbox>"Tis better to die on your feet, then live on your knees."
-
July 22nd, 2010, 22:24 #2
- Join Date
- Feb 2009
- Location
- Jacksonville, Florida
- Posts
- 153
I was thinking, couldn't I just copy the template_checkbox script and make a template_checkbox_gm script and just toss in the
function onInit()
if not User.isHost() then
setReadOnly(true);
end
end
Somewhere on top? Would that work?"Tis better to die on your feet, then live on your knees."
-
July 22nd, 2010, 23:41 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,559
Any time that you are using a template that is already defined with an onInit function, you need to call super.onInit in your new template or override script.
Also, you'll have to review the checkbox template to see if it supports setReadOnly, which is only predefined for built-in objects. (numbercontrol, stringcontrol, diecontrol, ...).
Cheers,
JPG
-
July 23rd, 2010, 14:17 #4
- Join Date
- Mar 2010
- Posts
- 44
The way I figured out how to make a checkbox gm only was to use onClickDown, you might try:
Code:function onClickDown(button, x, y) if User.isHost() then setState(not getState()); end end
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks