Author Topic: Centering cards  (Read 6303 times)

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Centering cards
« 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?
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: Centering cards
« Reply #1 on: October 26, 2010, 04:19:07 PM »
Quote from: "tools-n-stuff"
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:-


Code: [Select]
@ to center card 1
CardSetCenter(1)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

tools-n-stuff

  • Newbie
  • *
  • Posts: 38
Re: Centering cards
« Reply #2 on: October 26, 2010, 06:52:54 PM »
Cool, thanks Malkom
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

carlk

  • Newbie
  • *
  • Posts: 13
Re: Centering cards
« Reply #3 on: January 04, 2011, 03:35:05 AM »
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
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: Centering cards
« Reply #4 on: January 04, 2011, 06:51:51 AM »
Quote from: "carlk"
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.

Code: [Select]
@ 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.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

carlk

  • Newbie
  • *
  • Posts: 13
Re: Centering cards
« Reply #5 on: January 05, 2011, 08:26:18 AM »
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...

Code: [Select]
@ 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
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

carlk

  • Newbie
  • *
  • Posts: 13
Re: Centering cards
« Reply #6 on: January 05, 2011, 08:32:52 AM »
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
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 461
  • Here to help you
Re: Centering cards
« Reply #7 on: January 06, 2011, 01:34:31 PM »
Quote from: "carlk"
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...

Code: [Select]
@ 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.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.