Repaint Controls Help

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #35568
    wesley bobato
    Participant

    Hello Like to Know What's Best Way to Make a repaint in Controls in Runtime

    I Did So I wonder if this correct

    Thank You for reading and Reply.

    var

    I: Integer;

    begin

    for I := 0 to ComponentCount -1 do

    begin

    if Components is TsSpeedButton then

    if TsSpeedButton(Components).SkinData.SkinSection = 'BUTTON_HUGE' then

    begin

    TsSpeedButton(Components).SkinData.CustomFont := True;

    TsSpeedButton(Components).Font.Color:= ClWhite;

    end;

    end;

    sSkinManager1.RepaintForms;

    end;

    #49795
    Hamilton
    Participant

    I noticed a couple of releases back that some buttons and other controls in my apps weren't refreshing when font and color properties were being updated. It had worked in the past but suddenly I had to code around it. I think it's actually a bug – setting the colour *should* have an immediate effect without any more code. Anyway you can easily code around it as you've done, or more efficiently just refresh the control you're altering with a call to invalidate, refresh or repaint (normally invalidate but it depends on the control).

    TsSpeedButton(Components).Invalidate;

    Regards,

    Hamilton

    #49802
    wesley bobato
    Participant

    Thank you for your help me Could Pass This Procedure Details Invalidate what she really does is give a repaint? when should I call it Thanks.

    A Big Hug.

    #49804
    DarrenB
    Participant
    Quote:

    I noticed a couple of releases back that some buttons and other controls in my apps weren't refreshing when font and color properties were being updated. It had worked in the past but suddenly I had to code around it. I think it's actually a bug – setting the colour *should* have an immediate effect without any more code. Anyway you can easily code around it as you've done, or more efficiently just refresh the control you're altering with a call to invalidate, refresh or repaint (normally invalidate but it depends on the control).

    Hi Hamilton,

    I've noticed in a few controls there still exist a few refresh problems…they're not always refreshed EVERY time. I'm linking a few speed buttons to various alphaimagelists then changing their image index…most times it works but sometimes the image won't refresh until you either move the mouse over the button, or move away from the form/page and come back to it. It doesn't happen every time and believe me I've tried combinations of Invalidate, Refresh and Repaint but they don't always work. I don't think thats a bug in the execution/coding of the controls I think it might just be a small bug in the *flow* of execution. I had an idea though…because obviously (my example of speed button not always refreshing) the image is 'there' cos it appears when mouse is moved over… do you think if the AC team (whilst the small 'bugs' are there) might implement a method/property of each control called something like

    WhateverAlphaSkinsControl.EmergencyRedraw;

    this would call the root code drawing of the item…that root code is there and it works cos …well my example again…image is shown when mouse is moved over control or page is changed then come back to…so drawing code is fine just not always the *updating* code. Maybe they're already doing that though cos thats what .Redraw is supposed to do? What do you think?

    #49807
    DarrenB
    Participant

    Wow cool day for me…

    thinking about your advice on really finding out which of Invalidate, Refresh, Repaint would work for my speedbutton problem I tried them all and nothing. Then I did this

    sspeedbuttonEditPreview.Invalidate;

    sspeedbuttonEditPreview.refresh;

    *together and in that order*

    which kinda makes sense and i wonder why it didn't occur to me…invalidate says 'invalidate this'…then it makes sense to call the refresh to 'refresh what you just invalidated'. Anyway…it works for my problem here. Hope it helps someone else 🙂

    EDIT UPDATE*** Tested for the last 30 mins in all areas of my main app that were experiencing button update problems. Looks as solid as a rock all update issues now gone *touch wood*

    EDIT UPDATE 2*** It works all the time here…never had one fail yet after over 14 hours of solid programming/testing main app 🙂

    #49808
    wesley bobato
    Participant

    Hello Friend Looks like I managed to do Work.

    A Hug to All.

    ==============================================================================================================

    var

    I: Integer;

    begin

    for I := 0 to ComponentCount -1 do

    begin

    if Components is TsSpeedButton then

    if TsSpeedButton(Components).SkinData.SkinSection = 'BUTTON_HUGE' then

    begin

    TsSpeedButton(Components).SkinData.CustomFont := True;

    TsSpeedButton(Components).Font.Color:= clRed;

    //TsSpeedButton(Components).Update; does not work

    //TsSpeedButton(Components).Refresh; does not work

    //TsSpeedButton(Components).Repaint; does not work

    //TsSpeedButton(Components).Invalidate; does not work

    //TsSpeedButton(Components).Canvas.Refresh; does not work

    //TsSpeedButton(Components).GraphRepaint; does not work

    end;

    end;

    sSkinManager1.RepaintForms; //Only works well

    end;

    ==============================================================================================================

    #49830
    Support
    Keymaster

    Hello All

    TsSpeedButton will be repainted automatically in the nearest release.

    Wesley, for a full repaint of Alpha controls may be used this code : TsSpeedButton(Components).SkinData.Invalidate

    #49831
    DarrenB
    Participant
    'Support' wrote:

    Hello All

    TsSpeedButton will be repainted automatically in the nearest release.

    Wesley, for a full repaint of Alpha controls may be used this code : TsSpeedButton(Components).SkinData.Invalidate

    Thankyou Serge 🙂

    #49840
    wesley bobato
    Participant

    Thank you my friend for your attention, but unfortunately I use TsSpeedButton (Components ). SkinData.Invalidate the event

    sSkinManager1AfterChange and unfortunately it crashes when I switch skins. I use another event?

    #49878
    Support
    Keymaster

    You sure that you need this code in the OnAfterChange event?

    I'll try to reproduce an error.

    #49879
    Support
    Keymaster

    Show all code in the OnAfterChange event, please.

    A demo-application will be better.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.