Welcome, Guest
Please Login or Register.    Lost Password?

Auto Window Sizing...
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Auto Window Sizing...
#15673
Auto Window Sizing... 2 Years, 8 Months ago  
Hi All,

I'm trying to create a new digital clock for myself, but it's based on the digital clock in the Shadow4 skin.

Ok here's what I want to do...

1. Adjust window size depending on fontsize and time format.
2. Keep time centered in window regardless of fontsize and/or format (a string length of the time output would be helpful here).

I'm still trying to understand the positioning system, but I think I have the basics. But what is eluding me is how to take the time format value, and create a useable variable that will give me the string length. Does that make sense?

Could someone point me in the direction of a skin or script that could possibly help me here?

Thanks

Glenn
Mirage
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2011/07/27 10:36 By Mirage.
The administrator has disabled public write access.
 
#15675
Re:Auto Window Sizing... 2 Years, 8 Months ago  
Although you can use a script to grab the time-format length, but unable to change the window width and height from the script, so according to time-format length automatically adjusts the window is not possible (at least for now)

If you do not take into account the time-format length, consider only the font-size, can try this way:
(you need to modify 3 files: skin.xml, DigiClock.xml, elements.xml)
Code:

Add following into skin.xml
<variable name="DigiClock_fontsize" default="13" />

Add following into elements.xml
<font id="font.clock" facename="Tahoma" weight="Bold" size="%DigiClock_fontsize%" />

Add following into DigiClock.xml
<window id="DigiClock" w="(%DigiClock_fontsize% * 7)" h="(%DigiClock_fontsize% * 2)" threshold="48" default="0" >
  <time id="DigiClock.time" align="CENTER" x1="(%DigiClock_fontsize% * 7)/2" y1="%DigiClock_fontsize%" element="font.clock" format="%Format%" timezone="%Timezone%" DST="1"/>
</window>


how to take the time format value, and create a useable variable that will give me the string length
Code:

  Time_Format = Rainlendar_GetVariable(skin, window, "Format")
  ShowFormat = os.date(Time_Format)
  ShowFormat_len = string.len(ShowFormat)

anoob
Platinum Boarder
Posts: 476
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
#15677
Re:Auto Window Sizing... 2 Years, 8 Months ago  
Thanks for the reply and suggestions. I'll take a closer look at what you provided when I have more time. But it appears at first glance that it may be what I'm looking for, or at least points me down the right path.

Thanks again, and as I investigate this problem I'll post back. Maybe it could help someone in the future as well.
Mirage
Junior Boarder
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop