[i18n] CultureBox changing occurs creation forms!

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

[i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » July 12th, 2012, 6:14 pm

Hello!
The project have non auto-creation forms, and when I change language by choosing it in TCultureBox. These forms will be create automatically(not by me), and i Can't close it Only terminate the process and refuse using i18n.

Can you fix this problem?
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby Kambiz » July 12th, 2012, 8:35 pm

Sorry, I didn't get how this happens. Could you please post or attach the code?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » July 12th, 2012, 9:23 pm

hm, I'm not understand how it's happens o_O.
I've made sample application and all works fine..

Only what I can do now is a made video demo:
https://www.dropbox.com/sh/k69ia1st0blj ... ample2.zip

On each form placed TTranslator and linked to TLocalizer on main form. Window with no title is a EmptyForm, other windows is a RulesEditorForm. These forms is auto-create. One window also was shows while I'm not disabled DoubleBuffered property on it. Now I was disabled this form property on all forms but result you can see now on demo. Two forms already stays and makes problem.

How I can help you to find this bug? Where i'm need to place breakpoint in source code of TCultureBox(or in some else code of some?) for find bug?
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby Kambiz » July 13th, 2012, 5:23 pm

Sorry but it's difficult to find the reason of that problem using a video.
I need a sample code that regenerates the issue, otherwise it is impossible for me to find out origin of the problem and fix it.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » July 13th, 2012, 6:05 pm

Sorry, I'm don't have a bug code...
I think, it happens when translate/class/interface component call the form for enumerate it's child controls. Where I can find it?

Where and what event arises when I change the language? (in TCultureBox, I doesn't found it)
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby Kambiz » July 14th, 2012, 10:29 am

The select (protected) method of TCustomCultureBox changes the localizer's locale, but knowing that is not so much help.
I do suggest to review your code. Maybe by a mistake click, an event handler is connected to one of the localizer or translator events.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » July 14th, 2012, 6:46 pm

YES! I'm made it!
I'm made example project with this bug.

Notes:
All forms with visible:=False
Localizer placed in DataModule

After start, Main form are visible and I have two windows: Form2 and Form3 is also visible but it's fake windows and I can't control it(Likes in a demo video).
But now I'm only start program, no change language or something else.. I think problems in Localizer initialization or creation..
Attachments
12312312.rar
Coded with Delphi XE2
(581.79 KiB) Downloaded 56 times
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby Kambiz » July 15th, 2012, 4:20 pm

The creation order of auto-created data modules and forms is important. For your case, the DataModule must be created before other forms.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » July 16th, 2012, 11:10 am

Problem resolved in demo:) , but don't fixed in project :shock:
The magic window still created and I'm can't control it.

Why this bug occurs without DataModule, If I'm put TLocalizer on MainForm?

1 problem with constants also not resolved. What do you think about it?

Thanks :)
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » July 18th, 2012, 6:03 pm

I'm resolved problem in my project, but forms creation in run-time isn't solution. :(
Not all forms might be created in run-time. :cry:

Please fix this bug.
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby Kambiz » July 23rd, 2012, 9:09 pm

I believe that the problem is the order of form creation not the auto form creation.
Or maybe component loading in Delphi XE2 has changed, because I've tested the i18n package on Delphi 2009 and 2010 only.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » August 18th, 2012, 4:20 pm

Greetings, Kambiz! I'm found the "error" code..
Code: Select all
procedure TTranslator.EndUpdate;
begin
  Dec(fUpdateCount);
  if (fUpdateCount = 0) and (Owner is TWinControl) then
  begin
    if TWinControl(Owner).HandleAllocated then
    begin
      //TWinControl(Owner).Perform(WM_SETREDRAW, 1, 0);
      {RedrawWindow(TWinControl(Owner).Handle, nil, 0,
        RDW_ERASE or RDW_INVALIDATE or RDW_ALLCHILDREN or RDW_UPDATENOW); }
    end;
    if (Owner is TCustomForm) and Assigned(fActiveControl) then
      TCustomForm(Owner).ActiveControl := fActiveControl;
  end;
end;


hm, before showing, the window is invisible... Your code doesn't consider that and paint it. So we have 2 windows, 1 painted by TApplication and is invisible, 2 window painted by i18n and is visible, but non control.

I've comment these strings and bug is fixed, but now after change language, window doesn't redraw automatically.
How fix it?

Also: http://msdn.microsoft.com/en-us/library ... 19(v=vs.85).aspx
If the application sends the WM_SETREDRAW message to a hidden window, the window becomes visible (that is, the operating system adds the WS_VISIBLE style to the window).
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk

Re: [i18n] CultureBox changing occurs creation forms!

Postby Kambiz » August 19th, 2012, 2:03 pm

Thank you so much! Finding the reason of a bug is mostly as same as fixing it.

You can download i18n package v1.2, which fixed the bug.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: [i18n] CultureBox changing occurs creation forms!

Postby arhangelsoft » August 19th, 2012, 2:23 pm

Thanks for quick response and fix! :)
Your i18n package is the bests of all!
arhangelsoft
Junior Member
Junior Member
 
Posts: 39
Joined: February 16th, 2012, 9:56 pm
Location: Belarus, Minsk


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron