2 registered members (NnamueN, 1 invisible),
1,489
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
button reaction
#271507
06/13/09 15:29
06/13/09 15:29
|
Joined: Jun 2009
Posts: 148
gamingfan101
OP
Member
|
OP
Member
Joined: Jun 2009
Posts: 148
|
hi, im trying to create an image that uses a button to make a bitmap pop up. How would i call the button to pull up a bitmap when pressed? Thanks!
Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
|
|
|
Re: button reaction
[Re: gamingfan101]
#271508
06/13/09 15:35
06/13/09 15:35
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
PANEL* your_pan = //your panel
{
bmap = panel;
pos_x = 50;
pos_y = 705;
layer = 6;
}
function turn_on()
{
set(your_pan, SHOW);
}
PANEL* button_pan =
{
pos_x = 0;
pos_y = 0;
layer = 6;
button(0, 0, on, off, over, NULL, NULL, NULL);
}
|
|
|
Re: button reaction
[Re: Rei_Ayanami]
#271570
06/13/09 23:40
06/13/09 23:40
|
Joined: Jun 2009
Posts: 148
gamingfan101
OP
Member
|
OP
Member
Joined: Jun 2009
Posts: 148
|
ok, i used the code but the bitmap shows up at the beginning, i want it to show up after i press the button. "nxt_hi.bmp" is my bitmap i want to show up, and "nxtorange" is my button to make the bitmap show up. heres the code.
PANEL* nxthi_panel = { bmap = nxt_hi.bmp; pos_x = 275; pos_y = 170; layer = 3; flags = OVERLAY | VISIBLE; }
function turn_on() { set(nxthi_panel, SHOW); }
PANEL* button_panel = { pos_x = 340; pos_y = 165; layer = 3; button(0, 0, "nxtorange.bmp", "nxtorange.bmp", "nxtorange.bmp", NULL, NULL, NULL); flags = OVERLAY | VISIBLE; }
Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
|
|
|
Re: button reaction
[Re: gamingfan101]
#271587
06/14/09 01:52
06/14/09 01:52
|
Joined: Jun 2009
Posts: 148
gamingfan101
OP
Member
|
OP
Member
Joined: Jun 2009
Posts: 148
|
ok, heres what ive come up with.
PANEL* nxthi_panel = { bmap = nxt_hi.bmp; pos_x = 275; pos_y = 170; layer = 3; flags = OVERLAY | VISIBLE; }
PANEL* button_panel = { pos_x = 340; pos_y = 165; layer = 3; button(0, 0, "nxtorange.bmp", "nxtorange.bmp", "nxtorange.bmp", turn_on, NULL, NULL); flags = OVERLAY | VISIBLE;
function turn_on() { set(nxthi_panel, SHOW); }
when i include the "turn_on" function in the button line of code, my bitmap comes up at program start. And when i dont include it the button doesnt pull anything up. I want it to work like this: When i press the button (nxtorange) I want the bitmap to come up (nxt_hi.bmp) Thanks again!
Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
|
|
|
Re: button reaction
[Re: gamingfan101]
#271683
06/14/09 12:51
06/14/09 12:51
|
Joined: May 2009
Posts: 258 Chicago
Jaeger
Member
|
Member
Joined: May 2009
Posts: 258
Chicago
|
Untested, but I'm positive it will work...
// Always define image filenames with the BMAP* pointer....
// Don't write the filename in the definition of buttons or panels!
// Do it like this:
BMAP* nxthhi = "nxt_hi.bmp";
BMAP* nxtorange = "nxtorange.bmp";
// Define a prototype of your function so it won't be an undeclared identifier:
function turn_on();
// Here, you DON'T set the SHOW flag. Also, VISIBLE is ONLY for old versions of A7,
// so don't use VISIBLE. Only use OVERLAY when you need black RGB(0,0,0) parts of
//a bmap to be invisible
PANEL* nxthi_panel =
{
bmap = nxthhi;
pos_x = 275;
pos_y = 170;
layer = 3;
flags = OVERLAY; // DONT PUT SHOW OR VISIBLE! The function will do that when you click button!
}
PANEL* button_panel =
{
pos_x = 340;
pos_y = 165;
layer = 3;
button(0, 0, nxtorange, nxtorange, nxtorange, turn_on, NULL, NULL);
flags = OVERLAY | SHOW;
}
// Now turn it on when you click....
function turn_on()
{
set(nxthi_panel, SHOW);
}
YOU were setting the flags of the nxthi_panel to SHOW when the program began. It's only supposed to show up when you click the button. So you DON'T put SHOW (NOR VISIBLE) in the panel's definition. That makes it visible on start up. Also, VISIBLE is no longer used for panels/bmaps. SHOW is the new keyword. I don't have any idea why you used it, unless you've got an old A7. You could also *totally* omit the "flags = whatever " part from the definition of the panel, and just use: set(nxthi_panel,SHOW | OVERLAY); This is all really basic stuff. Be sure to use the manual and run through the workshops if you haven't yet...
Last edited by Jaeger; 06/14/09 13:00.
|
|
|
Re: button reaction
[Re: Jaeger]
#271727
06/14/09 18:34
06/14/09 18:34
|
Joined: Jun 2009
Posts: 148
gamingfan101
OP
Member
|
OP
Member
Joined: Jun 2009
Posts: 148
|
ok, thanks a lot! I really apprectiate it!
Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
|
|
|
Re: button reaction
[Re: gamingfan101]
#271731
06/14/09 18:59
06/14/09 18:59
|
Joined: Jun 2009
Posts: 148
gamingfan101
OP
Member
|
OP
Member
Joined: Jun 2009
Posts: 148
|
hey, i corrected the code, but now it says there is a problem in "main line 43" (that would be "PANEL* nxthi_panel =" )
BMAP* nxthi_bmp = "nxt_hi.bmp"; BMAP* nxtorange_bmp = "nxtorange.bmp"; function turn_on()
PANEL* nxthi_panel = { bmap = nxthi_bmp; pos_x = 275; pos_y = 170; layer = 3; flags = OVERLAY; }
PANEL* button_panel = { pos_x = 340; pos_y = 165; layer = 3; button(0, 0, nxtorange_bmp, nxtorange_bmp, nxtorange_bmp, turn_on, NULL, NULL) flags = OVERLAY | SHOW; }
function turn_on() { set(nxthi_panel, SHOW); }
Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
|
|
|
Re: button reaction
[Re: MrGuest]
#271736
06/14/09 19:21
06/14/09 19:21
|
Joined: Jun 2009
Posts: 148
gamingfan101
OP
Member
|
OP
Member
Joined: Jun 2009
Posts: 148
|
wow, sorry about that. Now it says there are too many parameter flags. What does that mean? and what should i do?
Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
|
|
|
Re: button reaction
[Re: gamingfan101]
#271739
06/14/09 19:30
06/14/09 19:30
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
Serious User
|
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
The same, missing a ; after: button(0, 0, nxtorange_bmp, nxtorange_bmp, nxtorange_bmp, turn_on, NULL, NULL) ;
Last edited by Widi; 06/14/09 19:31.
|
|
|
|