🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6275

Re: [Vladimir Stefanovic] Displaying everyday tips

#6275
From: Vladimir Stefanovic
Date: Tue, 31 May 2005 18:49
89 lines
3756 bytes
Well,

I recently made a Serbian-English / English-Serbian handy
dictionary and it can be placed in the tray on startup.

Then I wanted to show "Tip of the Day" with XP balloon tip.

I do *not* wanted the tips to be shown randomly, and I wanted
them to be shown in a *sequence* every day, so I needed some
VALUE which is every day increased by one, and DayOfTheYear:

   BCB/VCL Help
   <quote>
      Returns the number of days between a specified TDateTime value
      and December 31 of the previous year.
   </quote>

But you may be confused by rest of the code:

   <code>
      long number = DayOfTheYear( Now() );
      long position = 0;

      long AFrom = IDS_SER_MAIN_TIPS_01;
      long ATo   = IDS_SER_MAIN_TIPS_29;

      long module = ( ( ATo - AFrom ) / 2 ) + 1;

      ++position;

      long to_show = ( number + position ) % module;

      AnsiString Caption = X(IDS_SER_MAIN_HELPTIPOFTHEDAY);
      AnsiString Body = X( to_show * 2 + AFrom );
   </code>

...and that's because I have dual interface and all the strings to be
shown are stored in the RC files and in this manner: serbian word, english 
word

For example:

   IDS_SER_MAIN_TIPS_01,
      "Da li ste znali da klik desnog tastera mi�a na\r\n"
      "slobodnoj povr�ini re�nika poziva priru�ni meni?";
   IDS_ENG_MAIN_TIPS_01,
      "Did you know that right mouse button click on the\r\n"
      "free dictionary surface calls the popup menu?";

   IDS_SER_MAIN_TIPS_02,
      "Da li ste znali da pre�ica sa tastature Alt+U\r\n"
      "otvara priru�ni meni?";
   IDS_ENG_MAIN_TIPS_02,
      "Did you know that keyboard shortcut Alt+U\r\n"
      "opens the popup menu?";

   // ...
   // ...
   // ...

   IDS_SER_MAIN_TIPS_29,
      "Da li ste znali da kada pritisnete desni taster mi�a\r\n"
      "na neku ve� prevedenu frazu u polju prevoda\r\n"
      "- ta fraza �e automatski biti izabrana kao slede�a?";
   IDS_ENG_MAIN_TIPS_29,
      "Did you know that when you press the right mouse\r\n"
      "button above some already translated phrase in the\r\n"
      "translation region - that phrase will automatically\r\n"
      "be selected as a next one?";





-- 
Best regards,
Vladimir Stefanovic
"Danila Vershinin" <danprep@yahoo.com> wrote in message 
news:429ca796@newsgroups.borland.com...
> Hi Vladmir,
> in one of your posts on the balloon tooltips thread I started you've 
> mentioned about displaying different tips every day
>
> < // SKIP THIS. It's just a mechanism to display different tip of the day, 
> every day
> <            long number = DayOfTheYear( Now() );...........
>
> Please explain me your approach to do this, I am interested.
> 
Technical Details
Message-ID: <429cb1ae@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <429ca796@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,cb803323f0ebb454
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <429ca796@newsgroups.borland.com>
Subject: Re: [Vladimir Stefanovic] Displaying everyday tips
Date: Tue, 31 May 2005 20:49:17 +0200
Lines: 91
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 82.117.212.65
Message-ID: <429cb1ae@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1117565358 82.117.212.65 (31 May 2005 11:49:18 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail