HyperNext Studio
HyperNext Studio => General => Topic started by: tools-n-stuff on October 26, 2010, 02:29:40 PM
-
I guess the title says it all, but i was wondering if there wasn't a way of having the cards display in the center of the screen?
-
I guess the title says it all, but i was wondering if there wasn't a way of having the cards display in the center of the screen?
Use the following command and place it in the Card's script although it can be placed in a button etc:-
@ to center card 1
CardSetCenter(1)
-
Cool, thanks Malkom
-
I don't recall where in my reading I found that using a parameter of zero in this command will center the current card. Anyway, I put this command into the beginning the script for each of my cards....
CardSetCenter(0)
And it works except for one annoying behavior. First the card is displayed at its default location (upper left corner of the screen) and then it jumps to the center position.
I understand that a card needs to appear before its script can run, so I'm wondering ... is there a way to get each card centered yet avoid this jumping?
Thanks,
Carl
-
I don't recall where in my reading I found that using a parameter of zero in this command will center the current card. Anyway, I put this command into the beginning the script for each of my cards....
CardSetCenter(0)
And it works except for one annoying behavior. First the card is displayed at its default location (upper left corner of the screen) and then it jumps to the center position.
I understand that a card needs to appear before its script can run, so I'm wondering ... is there a way to get each card centered yet avoid this jumping?
Thanks,
Carl
Yes, placing the command inside the card to be centered has this annoying delay.
However, if you place the CardSetCenter command in the StartUp section of the MainCode section then it will center your card before it opens and loads.
@ center card 2
CardSetCenter(2)
By the way, this works fine on Macintosh but there is a bug on Windows XP - the card's top remains unchanged so it would need calculating manually using the ScreenHeightFN, CardHeightFN functions and then calling the CardSetTop command.
-
In a stack of many cards, such as I now have, it's inconvenient to put individual card centering commands into the Startup script of the MainCode for each card. Also, if the stack will add cards during use, as mine does, the new cards wouldn't be included in the programmed centering code. So here's what I came up with to center all cards in the stack...
@ use in Startup script of MainCode to center all cards in stack before opening home card
Local numCards,x
Put TotalCardsFN into numCards
For x=1 to numCards step 1
CardSetCenter(x)
EndFor
-
I forgot to add to my previous posting that, as a Mac user, this works fine for me. I presume Windows XP users could incorporate some additional code into what I provided that would calculate the new location of the card's top and call the CardSetTop command.
Carl
-
In a stack of many cards, such as I now have, it's inconvenient to put individual card centering commands into the Startup script of the MainCode for each card. Also, if the stack will add cards during use, as mine does, the new cards wouldn't be included in the programmed centering code. So here's what I came up with to center all cards in the stack...
@ use in Startup script of MainCode to center all cards in stack before opening home card
Local numCards,x
Put TotalCardsFN into numCards
For x=1 to numCards step 1
CardSetCenter(x)
EndFor
Thats a good idea and thank you for the code example.