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 

Main form menu 'flickers' upon language load / change

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



Joined: 12 Mar 2012
Posts: 5

PostPosted: Wed Apr 18, 2012 9:55 pm    Post subject: Main form menu 'flickers' upon language load / change Reply with quote

Hi,

We have project with a about 50 forms. Using Delphi XE and SiLang 6.5.4.3. The project contains 3 languages which are currently all in the program (no .SIL or .SIB loading at startup). On the main form we have SiLang and siLangDispatcher all other forms have TSiLinked components.

The ActiveLanguage is set in the Form's OnFormCreate. When it displays the form or when we switch languages from the menu the Main menu starts flickering for about a second or so (Looks like 'retyping' the menu - more then once, which users find very anoying).

Even tried Hiding and Showing the form (and when that did not work a loop containing Sleep and Application.ProcessMessage for about 10 times). But then the flickering just came when the screen was shown again.

Anything we can do to prevent this?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Thu Apr 19, 2012 12:34 pm    Post subject: Reply with quote

Hello,

Do you use the standard VCL main menu or some custom VCL? It just looks like repainting problem of some custom drawing menu.
Back to top
View user's profile Send private message
John.Hofland



Joined: 12 Mar 2012
Posts: 5

PostPosted: Thu Apr 19, 2012 1:54 pm    Post subject: Response Reply with quote

It is an 'normal' TMainMenu.
AutoHotkeys = maAutomatic
AutoLineReduction = maAutomatic
AutoMerge = false
OwnerDraw = false

No events. And only one menu item with an OnClick that fills its sub-menu.

And just to be complete neither of the SiLang(Dispatcher) have events.

We did not have the problem before adding the TSiLang


I made a small 'movie' to show what is happening:
http://screencast.com/t/KNCTEvrfM77

It seems to ben just the 'top' menu/bar. And it also happens slowly when the 'manual' fill "Reopen" is 'opened'. But somehow not exactly the same. BTW the items in that sub-menu are excluded from translation.[/quote]
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Thu Apr 19, 2012 2:10 pm    Post subject: Reply with quote

It looks like either VCL issue which flickers when it needs to re-align items. As you can see there is also some flickering when you click on "Re-open" item. TsiLang doesn't perform anything special, it just @changes the Caption property of controls". Does the flickering go away if you resize your form and all the menu items will be at a single line under all languages?
Back to top
View user's profile Send private message
John.Hofland



Joined: 12 Mar 2012
Posts: 5

PostPosted: Thu Apr 19, 2012 2:29 pm    Post subject: Response Reply with quote

I have been testing with this for some time. It still occurs when the screen is much wider (and one line).

Also checked DoubleBuffering of the form being on. This is currently the only program using SiComponents (before we had MultiLang, all other Windows tools are administration so just English and most of our programs are web based - using our own database based translation).

We tested a lot, also searched the web for TMainMenu having this problem (found none, except something with DoubleBuffering and Merging child menus which is not the case).

The only thing that we can see that differs is the SiLang components. But to be fair there are two other Forms in the same project with a TMainMenu and TSiLangLinked a that do not have the problem. But the main one is bigger and there are other components (Lang and Dispatcher).

So yes although logic dictates SiLang being the issue it could be somewhere else, but we found no way of debugging this and finding any other known problems, we put our hope on you (preferably a known issue).

Can you give us any suggestions??
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2097

PostPosted: Fri Apr 20, 2012 10:39 am    Post subject: Reply with quote

Could you please try the following:
1. Make a copy of the unit where the problem appears.
2. Remove all the code from it except TsiLang related code.
3. Create a new simple project only with this new unit and check if the problem still appears.
4. If the problem reproduced then please send us this sample project.
5. If problem won't be reproduced then the only way I could see is to delete partially the code in the original unit step-by-step and test everytime to detect which code causes such problem.
Back to top
View user's profile Send private message
John.Hofland



Joined: 12 Mar 2012
Posts: 5

PostPosted: Fri Apr 20, 2012 12:24 pm    Post subject: Quick response Reply with quote

Thanks for the reply. This will take some time to do. So probably get back to you somewhere next week.
Back to top
View user's profile Send private message
John.Hofland



Joined: 12 Mar 2012
Posts: 5

PostPosted: Mon Apr 23, 2012 9:20 am    Post subject: Possible Solution Reply with quote

After some testing with a fully functioning main screen but none of the sub-screens, I came to some conclusions.

* When a menu is updated (add and remove items, changing texts but also enabling and disabling menu items) Windows updates the whole menu (still a bit weird but that is what happens)

* The DoubleBuffering property goes for the whole client area of the screen. But the client area does not contain the window border, title and yes also not the main menu.

* We update the menu far to often. (e.g. after opening a project due to different area's it will in total do at least 3 updates from different locations. Which of course stresses the rebuilding of the menu much more (a short flicker 3 time becomes one longer annoying flickering)

I got two solutions:
The first is of course trying to limit the number of screen/menu-updates.
The second is only a visibility solution to make sure that when updating Windows does not modify the screen.
Code:

  try
    LockWindowUpdate(Handle);
    Menu := nil;

    // Do menu updates here like:
    siLangDispatcher1.ActiveLanguage := (Sender as TComponent).Tag;

    Menu := MainMenu1;
  finally
    LockWindowUpdate(0);
  end;


This even removes any flickering when changing the language it just 'magically' swaps it.

I hope this is useful to other users...

And thanks very much for your time.
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