Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
108 user(s) are online (97 user(s) are browsing Forums)

Members: 0
Guests: 108

more...

Support us!

Headlines

 
  Register To Post  

Ask help for MUIA_Application_Version and Version command
Just can't stay away
Just can't stay away


See User information
Hi,
I'm working on a MUI program in C on OS4 and I have a little problem with the MUIA_Application_Version.

Before that I learned how to obtain a localized date, my MUIA_Application_Version string was simply a string.
But now I want to concatenate a localized date to this string and it doesn't work with the Version command.
What is strange is that it works fine when I look the version with Exchange commodity or with the class AboutBox.

More precisely, I have a string who contained "$VER: SysMon 2.1" and I want to concatenate a date, for example 01/10/2012.

With Exchange and AboutBox, I have the right string "SysMon 2.1 (01/10/2012)"
With Version, I obtain "SysMon 2.1 (%s)", if I use sprintf or snprintf, or "SysMon 2.1", if I use strcpy and strcat.
The results are the same if I replace the date string with a simple string.

Here is my code
char Chaine_Version_SysMon[128];    
    
char Date_SysMon[16];
    
char dtdate[LEN_DATSTRING];    /* date from DateToStr...dat_StrDate */
...
    
strcpy(Date_SysMon,dtdate);
    
sprintf(Chaine_Version_SysMon,"$VER: SysMon 2.1 (%s)",Date_SysMon); /* I tried to directly with dtdate */
           
or 
    
snprintf(Chaine_Version_SysMon,sizeof(Chaine_Version_SysMon),"$VER: SysMon 2.1 (%s)",Date_SysMon);        
           or
    
strcpy(Chaine_Version_SysMon,"$VER: SysMon 2.1");
    
strcat(Chaine_Version_SysMon," (");    
    
strcat(Chaine_Version_SysMon,Date_SysMon);        
    
strcat(Chaine_Version_SysMon,")");    
...
    
MUIA_Application_Version,Chaine_Version_SysMon,


With sprintf :
Version String = SysMon 2.1 (%s)
AboutBox = SysMon 2.1 (01/10/2012)
Exchange = SysMon 2.1 (01/10/2012)

With strcpy, strcat :
Version String = SysMon 2.1
AboutBox = SysMon 2.1 (01/10/2012)
Exchange = SysMon 2.1 (01/10/2012)

Sorry for the long post, but if somebody could say me where I'm wrong, it will be very nice :)
Thanks you by advance,
zzd10h



Go to top
Re: Ask help for MUIA_Application_Version and Version command
Just popping in
Just popping in


See User information
@zzd10h

1. Never use localized dates in version strings. The Version command will take care to convert the date accoring to your locale settings. The date format in version strings is fixed to "day.month.year", numbers only.

2. C:Version will only extract the string after the "$VER:" cookie from the program file. It cannot output strings that are built during the program's execution. Exchange will obtain the version string from the running application and hence show the string the application might have dynamically built at runtime.

3. Don't use non-length limiting string functions like sprintf/strcpy/strcat. Use snprintf/strlcpy/strlcat all the time instead, even if you know the final string will fit into the supplied buffer. This will save you a lot of hassle later on.

4. Don't use escape sequences of MUI's text engine in version strings. Only MUI knows how to handle them correctly. Other applications might become confused and may fail to output such a version string correctly.

5. Since you use Aboutbox.mcc, why do you reinvent the wheel and provide a complete own credits text instead of using Aboutbox.mcc's built in feature to replace placeholders like "%l" and "%t" by standardized texts like "Translations:" or "Thanks to:"?

Go to top
Re: Ask help for MUIA_Application_Version and Version command
Just can't stay away
Just can't stay away


See User information
Thank a lot for these explanations (and advices)
Therefore I just have to write

    MUIA_Application_Version,Chaine_Version_SysMon,"$VER: SysMon 2.1 (10.01.2012)"

For the AboutBox, I tried to use the built-in %t or %p but it was not localized, all was in english,

I will try these changes this evening.

Thank again, it's very nice !

Go to top
Re: Ask help for MUIA_Application_Version and Version command
Just popping in
Just popping in


See User information
Quote:
For the AboutBox, I tried to use the built-in %t or %p but it was not localized, all was in english,


The french translation has not yet been updated, but that is nothing to worry about. That's all. Just be patient.

Go to top
Re: Ask help for MUIA_Application_Version and Version command
Just can't stay away
Just can't stay away


See User information
Thank you Thore,
I thought that the MUIA_Appl_Version was a constant string, I didn't imagine that MUI could transform it on the fly.

MUIA_Application_Version,"$VER: SysMon 2.1 (04.10.2012)",
work just fine.

Great, MUI is really powerful :)

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project