Action Properties Dialog

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Action Properties Dialog

Post by standay »

Hi Sergey,

I'm using RVAControlPanel OnCreateForm to change the opening position of the dialogs. Works well to reposition:

Code: Select all

procedure TForm1.RVAControlPanel1CreateForm(Form: TForm);
begin
  Form.Position := poScreenCenter;
end;
However, I found that with properties dialogs the OK and Cancel buttons aren't positioned correctly:

incorrect.png
incorrect.png (12.1 KiB) Viewed 10785 times

And should look like this:

correct.png
correct.png (12.61 KiB) Viewed 10785 times

I added some code to account for this:

Code: Select all

procedure TForm1.RVAControlPanel1CreateForm(Form: TForm);
var
  i: integer;
begin
  Form.Position := poScreenCenter; 
  for i := 0 to Form.ComponentCount-1 do
  begin
    if Form.Components[i].ClassType = TButton then
    begin
      if (TButton(Form.Components[i]).Caption = 'OK') or (TButton(Form.Components[i]).Caption = 'Cancel') then
      begin
        TButton(Form.Components[i]).Top := Form.ClientHeight - TButton(Form.Components[i]).Height - 8;
      end;
    end;
  end;
end;
Thought you'd like to be aware of that.

Stan
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Action Properties Dialog

Post by Sergey Tkachenko »

I cannot reproduce the problem with buttons.
What versions of TRichView and Delphi do you use?
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: Action Properties Dialog

Post by standay »

Hi Sergey,

Richview right now is 20.5 and Delphi is 10.3

I tried it in the ActionTestUni demo and it does it there too for me. Here's what I did:
  1. Add

    Code: Select all

    Form.Position := poScreenCenter
    to the RVAControlPanel OnCreateForm.
  2. Run the demo.
  3. Menu: Table | Insert Table... (defaults are fine).
  4. Menu: Table Properties...
Resulting table properties dialog should show the problem.

Stan
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Action Properties Dialog

Post by Sergey Tkachenko »

I confirm the problem in Delphi 10.3
(Previously, I tested in Delphi 11, it does not have this problem).

I'll see what I can do.
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: Action Properties Dialog

Post by standay »

Sergey Tkachenko wrote: Sat Jan 21, 2023 2:47 pm I confirm the problem in Delphi 10.3
(Previously, I tested in Delphi 11, it does not have this problem).

I'll see what I can do.
Hmm, interesting that it's OK in D11. If you can figure out what it's doing in the source that would be great. Otherwise the fix I made works OK. I have no plans to upgrade my Delphi at this time due to cost. But, we'll see. I may change my mind later.

Thanks Sergey

Stan
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Action Properties Dialog

Post by Sergey Tkachenko »

As I can see, this is the only RichViewActions form that has this problem.
This form adjusts positions of these buttons in code, and form window recreation (that happens when assigning Form.Position) causes wrong realignment.
The full fix for this problem is too long to post it here, so you can use your workaround (you can add a check: "if Form is TfrmRVItemProp then")
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: Action Properties Dialog

Post by standay »

Sergey Tkachenko wrote: Sat Jan 21, 2023 5:41 pm As I can see, this is the only RichViewActions form that has this problem.
This form adjusts positions of these buttons in code, and form window recreation (that happens when assigning Form.Position) causes wrong realignment.
The full fix for this problem is too long to post it here, so you can use your workaround (you can add a check: "if Form is TfrmRVItemProp then")
I added that check to my code.

Note that it also does it on the object properties action dialog, same fix corrects that one though so all's well with that.

Thanks Sergey

Stan
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Action Properties Dialog

Post by Sergey Tkachenko »

All object properties (including table properties) are implemented in the same form, except for equations and report shapes.
Post Reply