Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
 
This new version of SAP Crystal reports have another issue with the focus event.
 
In some cases, the toolbar buttons are always disabled or in another cases when you minimize and maximize your window the toolbar buttons appear disabled.
 
You have two workarounds to this situation:
 
1º: Click on the buttons at the bottom of the viewer (size to fit, slider..), this will activate the toolbar buttons.
 
2º: insert this code in the window with the Crystal Reports viewer:
protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);
            HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
            source.AddHook(WndProc);
        }
 
        private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            // Handle messages...

            if (MyReportViewer != null)
            {
                MyReportViewer.Focusable = true;
                MyReportViewer.Focus();
            }
 
            return IntPtr.Zero;
        }
 
In my case (minimize, maximize), this resolved the problem.
 
regards
Posted 10-Oct-12 6:28am
Comments
Rajivhost at 30-Apr-13 2:19am
   
Hi,
I tried this but not work for me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 285
1 Zoltán Zörgő 170
2 OriginalGriff 140
3 Sergey Alexandrovich Kryukov 120
4 Maciej Los 115
0 OriginalGriff 7,740
1 DamithSL 5,769
2 Sergey Alexandrovich Kryukov 5,424
3 Maciej Los 5,076
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100