Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,574 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
close multiple panels/ mehrere Panels schließen #132362
05/27/07 19:48
05/27/07 19:48
Joined: May 2007
Posts: 19
Z
Zalon Offline OP
Newbie
Zalon  Offline OP
Newbie
Z

Joined: May 2007
Posts: 19
Hi everybody,

hope anybody can help with a piece of code. I'd like to create a button that closes all but one panel the player might have activated. The problem hereby: I don't know which panels might have the visible-flag at that time...
E.g. think of a menue like a options panel, from which the player might have choosen a button to display another panel.
Is there an array storing all active panels, so I could solve it with a function like "while (runner < i)" with i as panelindex?

Thanks!

-------------------

Hallo zusammen,

hoffe jemand hat eine gute Idee oder gar ein Stück Code zu meinem Problem. Ich möchte gerne einen Button erstellen, mit dem alle aktiven Panels (bis auf eines) auf einen Schlag geschlossen werden. Die Schwierigkeit liegt darin, dass ich jedoch nicht vorher weiß, welche Panel zu dem Zeitpunkt sichtbar sind.
Beispiel hierfür wäre ein Menue, wie z.B. ein Optionen-Panel, von dem aus der Benutzer über verschiedene Buttons andere Panels geöffnet hat.
Gibt es vielleicht einen Array, in dem alle aktiven Panel gespeichert werden, so dass man das Ganze mit einer while-Funktion und Abfrage der Panelindices lösen könnte?

Vielen Dank!

Re: close multiple panels/ mehrere Panels schließe [Re: Zalon] #132363
05/28/07 06:38
05/28/07 06:38
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Use ptr_first(any_panel) to find the first panel. Then use the C_LINK.next pointer to walk along the linked list of panels until the last (next == NULL).

Re: close multiple panels/ mehrere Panels schließe [Re: jcl] #132364
05/28/07 11:10
05/28/07 11:10
Joined: May 2007
Posts: 19
Z
Zalon Offline OP
Newbie
Zalon  Offline OP
Newbie
Z

Joined: May 2007
Posts: 19
Thanks for the hint. I had a look at the help-file concerning ptr_first, it mentioned the C_LINK "directory" and the next-pointer, but there are no more entries concerning these items.
Could you please go a bit more into detail on how to handle the next-pointer for Panels?

I coded the following:

...
Testpanel = ptr_first (PanelB);
while (Testpanel != NULL)
{
Testpanel.flags = 0;

Now I'd like to include the statement using the next-pointer.

Thanks a lot!

Re: close multiple panels/ mehrere Panels schließe [Re: Zalon] #132365
05/28/07 12:05
05/28/07 12:05
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Testpanel = ptr_first (PanelB);
while (Testpanel)
{
do_something_with(Testpanel);
Testpanel = Testpanel->link.next;
}

All objects struct are defined in atypes.h, there you can look up their members, like the C_LINK. BTW, don't set flags to 0 - reset the VISIBLE flag instead. Setting flags to 0 might also delete important internal flags.

Re: close multiple panels/ mehrere Panels schließe [Re: jcl] #132366
05/28/07 19:11
05/28/07 19:11
Joined: May 2007
Posts: 19
Z
Zalon Offline OP
Newbie
Zalon  Offline OP
Newbie
Z

Joined: May 2007
Posts: 19
Thanks again! I'll have a look at atypes.h immediately.

You mentioned the flags = 0 command, I picked that from the tutorial, unaware of possible errors caused by deleting internal flags. Maybe a warning in the help-files would prevent other Lite-C beginners like me to do use the same lines of code?

Anyway, I changed it to Testpanel.flags =! VISIBLE, I hope that will do it.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1