|
主题: 请教单选按钮问题
|
 飘雪无痕
职务:普通成员
等级:2
金币:1.0
发贴:514
注册:2000/11/8 14:55:33
|
#12001/12/5 16:13:31
我有以下实现单选按钮效果的代码,(一)是用于DR提供的单选按钮;(二)用于导入的小图片。但我在程序中看不到单选效果,请各位大侠指正。 (一) property pstate,pgrouplist
on getpropertydescriptionlist me list=[:] addprop list,#pstate,[#comment:"initial state",#format:#boolean,#default:false] addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:[]] return list end
on beginsprite me if pstate then turnmeon(me) end
on turnmeon me pstate=true sprite(me.spritenum).member.hilite=true repeat with i in pgrouplist if i<>me.spritenum then sendsprite(sprite i,#turnmeoff) end if end repeat end
on turnmeoff me pstate=false sprite(me.spritenum).member.hilite=false end
on mouseup me turnmeon(me) end
on selected me repeat with i in pgrouplist if sprite(i).pstate=true then return i end repeat end
(二) property ponmember,poffmember,pstate,pgrouplist
on getpropertydescriptionlist me list=[:] addprop list,#ponmember,[#comment:"on member",#format:#member,#default:""] addprop list,#poffmember,[#comment:"off member",#format:#member,#default:""] addprop list,#pstate,[#comment:"initial state",#format:#boolean,#default:false] addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:[]] return list end
on turnmeon me pstate=true sprite(me.spritenum).member=ponmember repeat with i in pgrouplist if i<>me.spritenum then sendsprite(sprite i,#turnmeoff) end if end repeat end
on turnmeoff me pstate=false sprite(me.spritenum).member=poffmember end
on mouseup me turnmeon(me) end
on selected me repeat with i in pgrouplist if sprite(i).pstate=true then return i end repeat end
|
 我是小马
职务:普通成员
等级:3
金币:17.0
发贴:794
注册:2000/11/13 14:56:59
|
#22001/12/5 17:18:51
将 addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:]
修改为 addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:[4,5,6]]
我试过,没有问题
|
 sbkd
职务:普通成员
等级:1
金币:0.0
发贴:31
注册:2001/12/5 17:19:55
|
#32001/12/5 17:24:46
这样来实现单选,太累了吧,!
|
 我是小马
职务:普通成员
等级:3
金币:17.0
发贴:794
注册:2000/11/13 14:56:59
|
#42001/12/5 17:47:51
你有什么更好的方法吗?
|
 飘雪无痕
职务:普通成员
等级:2
金币:1.0
发贴:514
注册:2000/11/8 14:55:33
|
#52001/12/6 9:04:19
mzgjingsi在上个帖子中说 引用: 将 addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:]
修改为 addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:[4,5,6]]
我试过,没有问题
对不起,贴的时候可能复制有问题,原来的是: addprop list,#pgrouplist,[#comment:"group list",#format:#list,#default:[ ]] 这样不行么? [4,5,6]表示什么?
|
 我是小马
职务:普通成员
等级:3
金币:17.0
发贴:794
注册:2000/11/13 14:56:59
|
#62001/12/6 11:36:11
这样也行
4,5,6是我给附的初值,没有什么特别的意义
pgrouplist是一个代表sprite通道号的列表
我想你实现不了主要是因为对行为的参数设置不正确 仔细研究一下程序,弄懂每个参数代表的意义
|