Page 1 of 1

Action Properties Dialog

Posted: Tue Jan 17, 2023 8:58 pm
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 10630 times

And should look like this:

correct.png
correct.png (12.61 KiB) Viewed 10630 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

Re: Action Properties Dialog

Posted: Wed Jan 18, 2023 9:55 am
by Sergey Tkachenko
I cannot reproduce the problem with buttons.
What versions of TRichView and Delphi do you use?

Re: Action Properties Dialog

Posted: Wed Jan 18, 2023 10:48 am
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

Re: Action Properties Dialog

Posted: Sat Jan 21, 2023 2:47 pm
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.

Re: Action Properties Dialog

Posted: Sat Jan 21, 2023 3:03 pm
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

Re: Action Properties Dialog

Posted: Sat Jan 21, 2023 5:41 pm
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")

Re: Action Properties Dialog

Posted: Sat Jan 21, 2023 6:09 pm
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

Re: Action Properties Dialog

Posted: Sat Jan 21, 2023 6:51 pm
by Sergey Tkachenko
All object properties (including table properties) are implemented in the same form, except for equations and report shapes.