|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Creation buttons in runtime
#254624
03/04/09 12:42
03/04/09 12:42
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
Okay, we can create panels, text and so on in tuntime... what about buttons - i can only change its state with button_state() so, i need to create buttons, defending of number of models(i'm making some kind of editor)... now i place button on the background and create different panels over them... but i'd like to find more simple way 
|
|
|
Re: Creation buttons in runtime
[Re: VeT]
#254631
03/04/09 13:03
03/04/09 13:03
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Keep re-creating every change to the panel using ent_create. Just build a creation string dynamically and use it in the pan_create. EG STRING* BuildStr = str_create("pos_x=4; pos_y=4;");
str_cat(BuildStr, " button(10,10, bmapOn, bmapOff, bmapOver, functionOn, functionOff, functionOver);");
str_cat(BuildStr, " button(20,10, bmapOn, bmapOff, bmapOver, functionOn, functionOff, functionOver);");
str_cat(BuildStr, " button(30,10, bmapOn, bmapOff, bmapOver, functionOn, functionOff, functionOver);");
//
if(MyPanel!=NULL) pan_remove(MyPanel);
MyPanel = pan_create(BuildStr, 1);
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Creation buttons in runtime
[Re: VeT]
#254646
03/04/09 13:47
03/04/09 13:47
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
BMAP* temp_bmap = "land_dark.jpg";
pan_create("pos_x=400; pos_y=400; bmap = temp_bmap;",999);
hm, this dont work for me... even simple
pan_create("bmap = land_dark.jpg;",99);
|
|
|
Re: Creation buttons in runtime
[Re: VeT]
#254647
03/04/09 14:04
03/04/09 14:04
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I dont know why "... bmap=temp_bmap; ..." doesnt work, I never tried it.
But to use the simple version use "... bmap =\"land_dark.jpg\"; ..."
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Creation buttons in runtime
[Re: VeT]
#254785
03/05/09 14:04
03/05/09 14:04
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Same as any panel you need to have a "flags=SHOW;" in there also or is is still invisible. Also, Ive just tested pan_create("bmap =\"land_dark.jpg\"; flags=SHOW; ",99);
pan_create("bmap=temp_bmap; flags=SHOW; ",99);and they both work, the second only if 'temp_bmap' is a global, local bmaps dont ever work in panels. PS The second one is my preferred option for non_permanent panels, it uses less nexus.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|