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 

Orpheus components

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



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Wed Mar 29, 2006 9:01 pm    Post subject: Orpheus components Reply with quote

Hi,

I'm using in D7 projects some Orpheus components (former TurboPower).
Right now I have problems retrieving for translation the OvcTabSheet pages of the OvcNotebook. The ovctabsheets are items of TOvsNoteBook.PageCollection (TovcCollection), but this collection is not recognized by the siLangLinker component.

A little help, please.

Thanks,
Ioan
Back to top
View user's profile Send private message Visit poster's website
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Thu Mar 30, 2006 3:48 am    Post subject: Reply with quote

Hi,

Unfortunately, this property is not "pretty well" designed and must be handled manually in source. So you can create some procedure in the source to initialize the captions of TOvsNoteBook. Run TsiLang Expert => Translate Source to translate this code with TsiLang. And after this add call to this procedure in OnChangeLanguage event of TsiLang and OnCreate of form. So your code will look like:
Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
  TranslateNotebook;
end;

procedure TForm1.TranslateNotebook;
begin
  OvcNotebook1.Pages[0] := siLang1.GetTextOrDefault('IDS_0' (* 'Page 1' *) );
  OvcNotebook1.Pages[1] := siLang1.GetTextOrDefault('IDS_1' (* 'Page 2' *) );
  OvcNotebook1.Pages[2] := siLang1.GetTextOrDefault('IDS_2' (* 'Page 3' *) );
  OvcNotebook1.Pages[3] := siLang1.GetTextOrDefault('IDS_3' (* 'Page 4' *) );
end;

procedure TForm1.siLang1ChangeLanguage(Sender: TObject);
begin
  TranslateNotebook;
end;
Back to top
View user's profile Send private message
Ioan



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Wed Apr 05, 2006 5:54 pm    Post subject: Reply with quote

Hello,

I have another problem with another Orpheus componets, the TOvcCheckList. I tried something similar like the OvcNotebook, but I cannot make it work.

A form created at run-time includes a TOvcCheckList with 5 strings in the list. When the form is created with another language than the default (English) or when the language is changed while the form is opened, I get some (one or more) "Index out of bounds" errors.
Also, in design mode, when I switch the language I get the same errors and the TOvcCheckList get the new strings and some extra old strings. It looks that the results differ, the extra strings can be one or more.

Please give me a hint for this too.
Thanks,
Ioan
Back to top
View user's profile Send private message Visit poster's website
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Thu Apr 06, 2006 12:26 pm    Post subject: Reply with quote

This TOvcCheckList is "not very good" designed component Sad
The fix below will work ONLY if you have same amount of items in this list box for each language.
You will need to do the following:
1. Modify ovccklb unit by adding:
Code:
    procedure LBInsertString(var Msg : TMessage);
      message LB_INSERTSTRING;

to the protected section of TOvcCheckList and as implementation:
Code:
procedure TOvcCheckList.LBInsertString(var Msg: TMessage);
begin
  inherited;
  FStates.Insert(Msg.Result, nil);
  if HorizontalScroll then
    ResetHorizontalScrollBar;
end;

2. Add the code similar to example below to language changing procedure:
Code:
procedure TForm1.FormClick(Sender: TObject);
var
   States: TList;
   I: Integer;
begin
  States := TList.Create;
  try
// saving the states of check marks
    for I := 0 to OvcCheckList1.Count - 1 do
      States.Add(Pointer(OvcCheckList1.States[I]));
// changing language
    siLang1.ActiveLanguage := 2;
// restore the states
    for I := 0 to OvcCheckList1.Count - 1 do
      OvcCheckList1.States[I] := TCheckBoxState(States[I]);
  finally
    States.Free;
  end;
end;

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



Joined: 14 Mar 2006
Posts: 22
Location: Canada

PostPosted: Thu Apr 06, 2006 2:30 pm    Post subject: Reply with quote

Hello,

Actually I needed only the ovccklb change, for the status I take care myself to reset it on language change.

The errors I got were generated by a mistake in my code: the translation of the strings from the OvcCheckList1 were different from the translations for the strings retrieved in the code!!
So, I was trying an OvcCheckList1.Items.IndexOf(siLangLinked.GetTextOrDefault('IDS_xxx')) which failed.

Anyway, without the fix in ovccklb is much worse.

Thanks again,
Ioan
Back to top
View user's profile Send private message Visit poster's website
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