SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MessageDlg buttons

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
dcornelius



Joined: 27 May 2011
Posts: 7

PostPosted: Tue Jun 21, 2011 12:34 am    Post subject: MessageDlg buttons Reply with quote

I've got the MessageDlg function properly showing strings for different languages defined, but the OK/Cancel/Yes/No buttons never have any text--they are just blank.

I've got a Dialogs section in my .sil file, but perhaps it's not the right class name or something. Is there some detailed documentation about how to use this? How do I trouble-shoot my settings?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Tue Jun 21, 2011 5:58 am    Post subject: Reply with quote

Hello,
The most possible reason for this could be either:
1. TsiLang components has no Dialogs section and you don't load it from the SIL/SIB file.
2. You've used same TsiLang component names for different forms and use something like this, for example in the Unit of Form1:

with Form2 do
begin
siLang1.MessageDlg(....);
end;

This will use siLang1 from FORM2 but you intended to use the siLang1 from FORM1.

Please let us know if this helps.
Back to top
View user's profile Send private message
dcornelius



Joined: 27 May 2011
Posts: 7

PostPosted: Tue Jun 21, 2011 5:48 pm    Post subject: Reply with quote

Thanks for your quick reply. I haven't made any progress yet. Here's what I've got--perhaps explaining my situation further will reveal something I've done wrong.

My project has several forms and one unit without a form. I added a data module to hold the main TsiLang and TsiLangDispatcher components. All other forms have TsiLinkedLang components pointing to the TsiLang component on the data module.

One of the forms, whose labels and other controls can show various translations correctly, needs to display a message in certain circumstances. It calls the local component to do that:
Code:
siLangLinked.MessageDlg(siLangLinked.GetTextOrDefault('ID_CustomMsg'), mtInformation, [mbOK, mbCancel], 0);


The text from the GetTextOrDefault call shows correctly, but the OK/Cancel buttons are blank.

The .sil file, which is loaded through the data module's TsiLang component, has entries in the Dialogs section. The wizard automatically created a bunch with the class name of the data module as a prefix (i.e. TMyDataModule.All, TMyDataModule.Cancel, etc.). I have manually added entries for the form from which I am calling MessageDlg (i.e. TMyForm.All, TMyForm.Cancel, etc.) hoping that would fix the problem.

But the buttons are still blank.

Do I need to add entries to the CharSets or Fonts section? Or should I not be using a data module to hold the main TsiLang component?

One other question: I will also need to display messages from the one unit that does not have a form. How do I do that if the MessageDlg function uses the local form's font and CharSet settings? Will I have to find a way to refactor the code in order to display the messages from forms instead? Or will I have to call CreateMessageDlg and set the fonts and CharSets manually?

(Sorry for the long post...!)
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Wed Jun 22, 2011 4:17 pm    Post subject: Reply with quote

It looks like CommonContainer property of TsiLangLinked is not set to TsiLang component. This is the reason for empty buttons.

When you translate unit without form usign TsiLang Expert (menu File | Source | Without Form) it will automatically insert the code that will use the existing TsiLang on some form (that will hole translations for this string). So you don't need to create anything special.
Back to top
View user's profile Send private message
dcornelius



Joined: 27 May 2011
Posts: 7

PostPosted: Thu Jun 23, 2011 12:15 am    Post subject: Reply with quote

I'm pretty sure all that was set. I tried several things that seemed to make sense and match what you're telling me, but there must still be something amiss in my .SIL file or in my configuration.

I will mention that this project is a Delphi 5 plug-in that works inside a large application and the main part of the code does not have a form at all. Many of the messages need to display when there was no form already showing.

What I've done is create a form just for messages. I'm passing the ID of the string into an Execute method and the message is displayed dynamically. This is working (and I'm getting text on the buttons!) but the CharSet is not set correctly. In other words, English and Spanish work fine, but my tests with Russian and Chinese just show up as garbage.

I'll hit it again tomorrow--I know I'm close now.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Thu Jun 23, 2011 3:42 pm    Post subject: Reply with quote

Incorrect chars displayed on dialog buttons under Russian or Chinese language caused by use of ANSI IDE and VCL. So when your OS Default Locale doesn't support these languages the regional chars could be displayed incorrectly. You may consider to use Unicode IDE or VCL for message dialogs. Please check http://www.tsilang.com/delphiglobalizationtool_faq.html#21

Hope this helps.
Back to top
View user's profile Send private message
dcornelius



Joined: 27 May 2011
Posts: 7

PostPosted: Thu Jun 23, 2011 3:47 pm    Post subject: Reply with quote

I can't use anything but Delphi 5 for this particular project because it is a plug-in (.BPL). All the other forms are displaying other character sets correctly. My new one is not--I know it's something different and haven't figured it out yet. However, I used the wizard with the others and this one I added manually because I've added lots of entries the .SIL file. I may have to create a separate one for this form and merge the .SIL entries.
Back to top
View user's profile Send private message
dcornelius



Joined: 27 May 2011
Posts: 7

PostPosted: Fri Jun 24, 2011 5:26 am    Post subject: Reply with quote

I finally got this all working. I created a custom form and was still having problems with that, but I carefully compared the new form with a different form that was working and discovered there was a form-level setting on either the Fonts or the Charset section (I don't recall now). Basically, I needed to add an entry for TMyForm.TMyForm. (At least, I pretty sure that's what fixed it.)

In any case, it wasn't the components or the form itself, but the entries in my .SIL file that I needed to get straightened out.

Thanks for the help!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite 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


Powered by p h p B B  © 2001, 2005 p h p B B  Group