Don't pass the handle of the form. Put your controls on a panel (or panels) 
and pass the handles to those.  
   
     I only recommend freezing screendraws while the controls are actually 
being modified for a smoother effect. If you've got some process that takes 
several seconds, you should wait until that's over before freezing the screen 
(if possible). You shouldn't need to use an hourglass in other words.
   
  Dave

"Jamie L. Mitchell" <[EMAIL PROTECTED]> wrote:
          Thanks, Dave:

This works almost exactly right. One tiny problem, however. Here is
the code:

Begin
Screen.Cursor := crHourglass;
SendMessage(frmMain.Handle, WM_SETREDRAW, 0, 0);
try try
// Set the global flag
CurProjState := ftEditing;

// Now, set up the screen
SetProjInterface(CurProjState);

// Data is set to new
SetProjectData(GetSelectedKey(lbProjProjects));
Except
On E:Exception Do Begin
WriteStatus(SB, E.Message, TRUE);
End;
End;
Finally
SendMessage(frmMain.Handle, WM_SETREDRAW, 1, 0);
RedrawWindow(frmMain.Handle, nil, 0, RDW_ERASE or RDW_FRAME or
RDW_INVALIDATE or RDW_ALLCHILDREN);
Screen.Cursor := crDefault;
End;
End;

The screen freezes just right. Only problem is with the cursor. The
cursor turns from an hourglass to an arrow as soon as the message is
processed. If I put in a delay after setting the cursor, I can see it
change to an hourglass. Then, when the screen is frozen, it
automagically changes back into an arrow. The net effect is that the
user does not know that the system is actually doing something because
the cursor does not appear to be clocking.

Ideas?

jamie

--- In delphi-en@yahoogroups.com, David Smith <[EMAIL PROTECTED]> wrote:
>
> //this turns off screen draw for the visual control. Use for the
parent panel for the //controls you want to freeze
> // SendMessage(MainPanel.Handle, WM_SETREDRAW, 0, 0);
> 
> // perform data updates, control changes, etc.
> 
> // the first message turns screendraw back on, 2nd refreshes
> // SendMessage(mainPanel.Handle, WM_SETREDRAW, 1, 0);
> // RedrawWindow(mainPanel.Handle, nil, 0,
> // RDW_ERASE or RDW_FRAME or RDW_INVALIDATE or RDW_ALLCHILDREN);
> 
> Dave



         

                
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.

[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to