View Full Version : container placement
kingo'mountain
7th May 2002, 18:14
hey guys, moving along.... :)
i have a container, and i wanna set it up so it will open at certain
pixels from MY SKIN, so if i make it x="2" y="2" the container will
place itself at the top left of my skin,
possible?
Naamloos
7th May 2002, 18:26
possible in maki
get the coordinates of the first component
sum 2 with these coordinates
set the new coordinates at ur component, and use move="0" on that component
Gonzotek
7th May 2002, 18:54
Originally posted by Naamloos
possible in maki
get the coordinates of the first component
sum 2 with these coordinates
set the new coordinates at ur component, and use move="0" on that component
ARRRGGGG!!!!
COMPONENT = WASABI DLL
CONTAINER = XML container for layouts
CONTAINER != COMPONENT
Get it? ;p
Also, if I understood the question correctly, what you'd need to do is this:
1. Get the x,y values of your primary container/layout (let's call it mainnormal).
2. Get the w,h values of your other container/layout (call it layout2)
3. subtract the width of layout2 from the x of mainnormal and store in a variable layout2x
4. subtract the height of layout2 from the y of mainnormal and store in a variable layout2y
5. subtract the width you want layout2 to be from mainnormal (e.g. 2) from layout2x
6. subtract the height you want layout2 to be from mainnormal (e.g. 2) from layout2y
7. Finally, set layout2 to layout2x,layout2y
-=Gonzotek=-
Naamloos
7th May 2002, 19:15
Ah fuck. i hate this component != container :mad: :mad: :mad: :mad: :mad:
/me is off for more coffee
Francis
7th May 2002, 20:49
Originally posted by Naamloos
Ah fuck. i hate this component != container :mad: :mad: :mad: :mad: :mad:
/me is off for more coffee
I hate the fact that socks != pudding
You know, components and containers are two completely different thing, they have nothing to do with each other, one is an xml entity the other is a file, why do you "hate" that fact ? I mean, you could have taken any 2 random thing in the system and said ahh fuck i hate this a != b thing ... heh.
but anyway, try setting default_x and default_y in your container xml params, it should open the container there the first time and then the next time it'll just reopen it where it was last closed. You could put a bit of script to bring it back to a specific position each time if you needed.
Note that the skin is centered in the screen the first time it is loaded too, so the default coordinates you give are offset as much as needed to center the skin on first launch, then it starts saving the last positions.
Francis.
kingo'mountain
8th May 2002, 04:51
francis, good point, but have you thought about people's resolutions?
i have currently 1027 X 768 and i know some of you have greater res.
so using coordinates may turn ugly, unless you setup those coords
for yourself,
err, bizzy is helping me with the maki scripting, so dont worry
Naamloos
8th May 2002, 08:13
francis, youre completely right.
but what I meant, was that I misuse these words everytime :(
Originally posted by Francis
I hate the fact that socks != puddingYeah! i f-in hate that! Why can't someone make socks that can be used as pudding to stop this perpetual confusion.
mmmm... pudding socks.
;)
kingo'mountain
18th May 2002, 15:01
im desperate again.....
gonzo gave me this script:
#include <lib/std.mi>
global layout mainnormal, cbuttonsnormal;
global int mn_x, mn_y, cb_x, cb_y;
system.onscriptloaded(){
mainnormal = getContainer("main").getLayout("normal");
cbuttonsnormal = getContainer("CBcomponet").getlayout("normal");
mn_x = mainnormal.getLeft();
mn_y = mainnormal.getTop();
//Change the numerical values here to adjust exactly where you want cbuttonsnormal to appear.
//Experiment to find the best values.
//Adding to x moves things more to the right, subtracting would move them to the left
cb_x = mn_x + 65;
//Subtracting from y moves things upwards, adding would move them down.
cb_y = mn_y - 23;
cbuttonsnormal.resize(cb_x, cb_y,cbuttonsnormal.getWidth(),cbuttonsnormal.getHeight());
}
but it limits me, for this to happen, i need to keep the container visible :( i want it to work when the container isnt visible (eg. default_visible="0") and turn it on.... any suggestions?
Hollow
18th May 2002, 18:23
why do just do the same thing onShowLayout(layout name)? that way, it would be in the right place when it became visible.
kingo'mountain
18th May 2002, 18:32
hollowearth... sorry, im a total noob at maki, started learning today :)
well instead of onscriptloaded() i should put onshowlayout(layout)?
please write the full line and place of line
Hollow
18th May 2002, 19:38
include <lib/std.mi>
Global Layout mainnormal, cbuttonsnormal;
Global Int mn_x, mn_y, cb_x, cb_y;
System.OnScriptLoaded(){
mainnormal = getContainer("main").getLayout("normal");
cbuttonsnormal = getContainer("CBcomponet").getLayout("normal");
//removed code here: OnShowLayout will execute when the layout is
//shown, no matter when, so even when the skin is loaded.
}
//this is the extent of Gonzo's code.
//the onShowLayout is an event, just like onScriptLoaded
//So any code you put in it will execute when the event
//occurs. In this case, when the layout is shown.
System.onShowLayout(cbuttonsnormal)
{
//code copied from OnScriptLoaded (were it used to be).
mn_x = mainnormal.getLeft();
mn_y = mainnormal.getTop();
cb_x = mn_x + 65;
cb_y = mn_y - 23;
cbuttonsnormal.Resize(cb_x, cb_y,cbuttonsnormal.getWidth(),cbuttonsnormal.getHeight());
}
Is this what your looking for?
kingo'mountain
18th May 2002, 20:03
that didnt work :( are you sure its the right code?
i just copied what you gave me, no added stuff :)
if you know what the FULL code should be, plz shoot
Hollow
18th May 2002, 22:31
doh sorry kingo. I just kinda made that up without looking at anything. Thiw works. It was my stupid mistake. One note: this assumes that you only have one layout for cbuttonscontainer.
#include ..\..\lib\std.mi
Global Layout mainnormal;
Global Container cbuttonscontainer;
Global Int mn_x, mn_y, cb_x, cb_y;
System.OnScriptLoaded()
{
mainnormal = getContainer("main").getLayout("normal");
cbuttonscontainer = getContainer("thinger");
}
cbuttonscontainer.onShowLayout(layout _layout)
{
mn_x = mainnormal.getLeft();
mn_y = mainnormal.getTop();
cb_x = mn_x + 65;
cb_y = mn_y - 23;
_layout.Resize(cb_x, cb_y,_layout.getWidth(),_layout.getHeight());
}
kingo'mountain
19th May 2002, 04:50
hollowearth, thank you so much for helping.. but
that didn't work either, i think i should turn to gonzo...
because if he gave me the script, he must know this..
sorry for the trouble
ill turn to you again for something else...
again sorry :)
Gonzotek
19th May 2002, 14:34
Try this, it's HollowEarth's code, I fixed it for your skin, specificly:
#include <lib\std.mi>
Global Layout mainnormal;
Global Container cbuttonscontainer;
Global Int mn_x, mn_y, cb_x, cb_y;
System.OnScriptLoaded()
{
mainnormal = getContainer("main").getLayout("normal");
cbuttonscontainer = getContainer("CBcomponet");
}
cbuttonscontainer.onShowLayout(layout _layout)
{
mn_x = mainnormal.getLeft();
mn_y = mainnormal.getTop();
cb_x = mn_x + 65;
cb_y = mn_y - 23;
_layout.Resize(cb_x, cb_y,_layout.getWidth(),_layout.getHeight());
}
-=Gonzotek=-
kingo'mountain
19th May 2002, 15:37
gonzo!!!!!!!!!!!!
hats off..... :cool: :cool: :cool:
you did it :D :D :D :D
im not worthy... im not worthy
:eek: :eek: :eek:
*peels shoes off feet and starts to bow for gonozo the god*
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.