SRL Archive - Help and Support

Refreshing a form


Pure1993

2008-12-28 14:37:52

Hey guys,
I just wanted to know if there is any command which refreshes the form… for eample I have: "exmaple1.left := example.x" ("example" being a record, and "x" being an integer), and I change the "example.x" from 5 to 8, and I want the form to refresh in order to show the change.
Thanks a lot,
Pure1993

Dan Cardin

2008-12-28 14:52:27

it should automatically change. No need to refresh

Naum

2008-12-28 15:28:32

Hmm. If you still get the problem change

yourformname.ShowModal;

to

Yourformname.Show;

Basically because ShowModal; doesn't let you run anything else once its open. That may be the problem…

Tootoot222

2008-12-28 17:17:37

YourForm.Refresh;

Avoid using this, as it causes horrible flicker/splitting

Pure1993

2008-12-28 17:22:52

Well, that's sort of interesting… I tried your way naum, but it didn't affect anything… here is the part in the form:

  P1C := TShape.Create(frmDesign);
P1C.Parent := frmDesign;
P1C.Left := Figure[2].CurrentX;
P1C.Top := Figure[2].CurrentY;
P1C.Width := 30;
P1C.Height := 30;
P1C.Brush.Color := clBlack;
P1C.Shape := stCircle;

and here are two ways, one works, one doesn't… (The RollButton is a button which can be pressed, obviously, and which triggers the following event)
This one doesn't work:

procedure Roll( Sender: TObject);
begin
repeat
RollR := Random(6);
until RollR > 0;
RollResult.Caption := IntToStr(RollR);
RollButton.Visible := False;
Figure[2].currentx := 5;
end;

Yet this one does:

procedure Roll( Sender: TObject);
begin
repeat
RollR := Random(6);
until RollR > 0;
RollResult.Caption := IntToStr(RollR);
RollButton.Visible := False;
P1c.Left := 5;
end;

I don't really get this, because in theory, both lead to the same thing… any explanation and advice on how I could make the first one work? (I am creating a board game in Scar, and I based the entire system of moving the pieces around the board on that system, so I am not really able to change it a lot…)

Dan Cardin

2008-12-28 20:15:44

posting whole script would be nice, or what type plc is? Kind of hard to diagnose something that i know nothing about.

bullzeye95

2008-12-28 22:57:19

From: tootoot222
YourForm.Refresh;

Avoid using this, as it causes horrible flicker/splitting


That's why there's double buffering.

Widget

2008-12-28 23:52:45

This isn't Python, Plc.Left will have whatever value Figure[2].currentx is at the time of assigning, but when you change Figure[2].currentx then Plc.Left won't change with it. You'll have to change both.

Pure1993

2008-12-29 03:31:57

ah, okay, thanks widget. Well, there goes my system down the drain again…:(

Dan Cardin

2008-12-29 09:10:41

well if thats your only problem, then i don't see why you can't change both at the same time? or use a timer, if you really have to.