- This topic has 10 replies, 4 voices, and was last updated 11 years, 10 months ago by Support.
-
AuthorPosts
-
January 6, 2013 at 9:21 pm #35568wesley bobatoParticipant
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;
January 7, 2013 at 4:49 am #49795HamiltonParticipantI 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
January 7, 2013 at 11:34 am #49802wesley bobatoParticipantThank 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.
January 7, 2013 at 1:48 pm #49804DarrenBParticipantQuote: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?
January 7, 2013 at 2:51 pm #49807DarrenBParticipantWow 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 🙂
January 7, 2013 at 3:36 pm #49808wesley bobatoParticipantHello 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;
==============================================================================================================
January 10, 2013 at 3:13 pm #49830SupportKeymasterHello 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
January 10, 2013 at 3:53 pm #49831DarrenBParticipant'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 🙂
January 11, 2013 at 7:44 pm #49840wesley bobatoParticipantThank 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?
January 14, 2013 at 9:34 am #49878SupportKeymasterYou sure that you need this code in the OnAfterChange event?
I'll try to reproduce an error.
January 14, 2013 at 9:36 am #49879SupportKeymasterShow all code in the OnAfterChange event, please.
A demo-application will be better.
-
AuthorPosts
- You must be logged in to reply to this topic.