A while back, I changed my Win32::GUI 0.558 sources and achieved flicker-free 
resize.  Here's what I did:
CHANGE LINE 4059 FROM: wcx.style = CS_HREDRAW | CS_VREDRAW; // TODO (default 
class style...)
TO: wcx.style = 0; 

That's it.  Now, I'm not exactly sure what other ramifications that has, but 
the resize is flicker-free now.

For everyone's benefit, I've gone through my code and found a few other 
enhancements I made.  The provided line numbers are all against an unmodified 
0.558 source (aka the oldest file available on sourceforge CVS).

--- GETSAVEFILENAME: Added support for a -flags option, see Windows API 
documentation for usage
ADD AFTER LINE 7257:
            // Support for -flags option
            if(strcmp(option, "-flags") == 0) {
                next_i = i + 1;
                ofn.Flags = SvIV(ST(next_i));
            }

--- RICHEDIT CONTROL: Added some additional functions
ADD AFTER LINE 9195:
    ###########################################################################
    # (@)METHOD:TextLength()
    # Returns the text length of the RichEdit control
LRESULT
TextLength(handle)
    HWND handle
PREINIT:
    GETTEXTLENGTHEX tl;
CODE:
    ZeroMemory(&tl, sizeof(GETTEXTLENGTHEX));
    tl.flags = GTL_DEFAULT;
    tl.codepage = CP_ACP;
    RETVAL = SendMessage(
        handle, EM_GETTEXTLENGTHEX, (WPARAM) (GETTEXTLENGTHEX FAR *) &tl, 0
    );
OUTPUT:
    RETVAL


    ###########################################################################
    # (@)METHOD:SetTextMode(MODE, UNDO)
    # Sets the RichEdit control's text mode
LRESULT
SetTextMode(handle,mode,undo)
    HWND handle
    int mode
    int undo
PREINIT:
    WPARAM wParam;
CODE:
    // SendMessage(handle, WM_SETTEXT, 0, (char *) "");

    wParam = 0;
    if(mode == 0) { wParam += TM_PLAINTEXT; }
    if(mode == 1) { wParam += TM_RICHTEXT; }
    if(undo == 0) { wParam += TM_SINGLELEVELUNDO; }
    if(undo == 1) { wParam += TM_MULTILEVELUNDO; }

    RETVAL = SendMessage(
        handle, EM_SETTEXTMODE, (WPARAM) wParam, 0
    );
OUTPUT:
    RETVAL


    ###########################################################################
    # (@)METHOD:SetMaxLength(LENGTH)
    # Sets the RichEdit control's maximum length (up to 2GB)
LRESULT
SetMaxLength(handle,length)
    HWND handle
    long length
CODE:
    RETVAL = SendMessage(
        handle, EM_EXLIMITTEXT, 0, (LPARAM) length
    );
OUTPUT:
    RETVAL


    ###########################################################################
    # (@)METHOD:GetTextRange(START, LENGTH)
    # Returns LENGTH bytes of text from the RichEdit control, starting at START
void
GetTextRange(handle,start,length)
    HWND handle
    LONG start
    LONG length
PREINIT:
    TEXTRANGE tr;
    CHARRANGE cr;
    char * text;
    LRESULT count;
PPCODE:
    ZeroMemory(&tr, sizeof(TEXTRANGE));
    ZeroMemory(&cr, sizeof(CHARRANGE));
    if(length < 0) length = 0;
    if(start < 0) start = 0;
    text = (char *) safemalloc(length+1);
    cr.cpMin = start;
    cr.cpMax = start+length;
    tr.chrg = cr;
    tr.lpstrText = text;
    count = SendMessage(handle, EM_GETTEXTRANGE, 0, (LPARAM) (TEXTRANGE FAR *) 
&tr);
    EXTEND(SP, 1);
    XST_mPV(0, text);
    safefree(text);
    XSRETURN(1);


Hope these help everyone.

Trevor Garside
[EMAIL PROTECTED]
(800) 648-8617 x1540




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Jeremy White
Sent: Friday, November 21, 2003 4:04 AM
To: [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net
Subject: Re: [perl-win32-gui-users] Win32::GUI::XMLBuilder


>From: Blair Sutton/Odey <[EMAIL PROTECTED]>

>My only problem is I don't really want to maintain a separate website to
>keep the code, really it would be nice to add it as an extras feature to
>Win32::GUI. I am willing to submit the code with some examples (still need
>to write documentation - although it's fairly straightforward). Any
>thoughts from anyone?

I guess the best thing to do is to submit the code and see what interest it 
generates. Having many utilities can on be a good thing.

>As for the flicker free resizing I have read that one way around it is to
>modify the style of the top Window to include WS_CLIPCHILDREN before
>resizing then reset it back afterwards. See
>http://www.codeguru.com/mfc/comments/42342.shtml.

I've tried this on the perl resize and in the xs resize, but no luck. For 
this to work WS_CLIPCHILDREN needs to be applyed on the mouse click for the 
resize - and I couldn't find a way to trap this event. Ideas any one?

Cheers,

jez.

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

Reply via email to