![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Sun, May 17 2015 4:51 PM | Permanent Link |
David Martin | I would like to change the background color of a panel for 2 seconds before reverting back to the original color. The code I have used does not work and I have traced it to behavior demonstrated in the following code:
BasicPanel1.Background.Fill.Color:=clOrange; Timer(2); // Pause for 2 seconds--this works and is not the problem ShowMessage('The color of the panel should have changed to orange by now, but it has not changed yet.'); The color of the panel changes to orange after the ShowMessage dialog is closed. How can I get the color to change before the Timer function is called? Thanks for any help. David Martin |
Sun, May 17 2015 7:11 PM | Permanent Link |
Raul ![]() | On 5/17/2015 4:51 PM, David Martin wrote:
> Timer(2); // Pause for 2 seconds--this works and is not the problem What does this do actually ?! Are you blocking the execution by looping or such? If so then likely no repaint takes place. > The color of the panel changes to orange after the ShowMessage dialog is closed. How can I get the color to change before the Timer function is called? i would suggest you use an actual timer for this. .... prevColor := BasicPanel1.Background.Fill.Color; BasicPanel1.Background.Fill.Color := clOrange; Timer1.Interval := 2000; Timer1.Enabled := true; .... procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := false; BasicPanel1.Background.Fill.Color := prevColor; end; .... Raul |
Sun, May 17 2015 8:38 PM | Permanent Link |
David Martin | Raul wrote:
>> Timer(2); // Pause for 2 seconds--this works and is not the problem >What does this do actually ?! As you surmised, this executes a dummy while loop for 2 seconds. I was not aware of the non-visual TTimer component that is on the System tab in the IDE. I followed your lead and was able to get the behavior I was looking for. Thank you! DM |
Mon, May 18 2015 4:00 AM | Permanent Link |
Matthew Jones | David Martin wrote:
> and was able to get the behavior I was looking for If you want to get fancy, check out the animation capabilities. I have a TPanel behind one button which I fade in and out to gentle bring attention to it. -- Matthew Jones |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |