DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Double as Fraction String

 
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
w2m
Member


Joined: 08 Mar 2003
Posts: 35
Location: New York, USA

PostPosted: 09/03/04 23:06    Post subject: Double as Fraction String Reply with quote

Dumb question I guess...

If I have a variable ShutterSpeed: double that is 0.02 or 1/200 how can I display ShutterSpeed as 1/200 as a string?
0.05 = 1/50sec
0.01 = 1/100sec
0.02 = 1/200sec
0.50 = 1/2sec


I googled for a while but could not find anything that works.

Regards
Bill

_________________
w2m
Back to top
View user's profile Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 386
Location: Tehran, Iran

PostPosted: 17/03/04 09:20    Post subject: Reply with quote

Code:
ShutterSpeedLabel.Caption := Format('1/%d sec', [Round(1 / ShutterSpeed)]);


Hope that it helps.
Kambiz
Back to top
View user's profile Send e-mail Visit poster's website
w2m
Member


Joined: 08 Mar 2003
Posts: 35
Location: New York, USA

PostPosted: 20/03/04 15:19    Post subject: Thanks... Reply with quote

Thanks... that did the trick... the method I was using was too complicated and used the lowest common denometer so it did not work with typical shutter speeds.

Bill

_________________
w2m
Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group