Lazarus

Programming => LCL => Topic started by: heeb on August 03, 2021, 07:48:20 pm

Title: Enable designtime functionality at runtime?
Post by: heeb on August 03, 2021, 07:48:20 pm
Hi,

I'm making an IDE-like application, a GUI builder (it's for external use, not itself related to Lazarus or FreePascal).

So, I need to be able to add and drag and resize controls at runtime, and also display a grid (or Lazarus-/Delphi-like dots at grid points) at runtime.

Since Lazarus itself is a Lazarus application, I guess achieving this shouldn't be too complicated.

What would be the easiest, most straightforward way of doing this?

Many thanks!
Title: Re: Enable designtime functionality at runtime?
Post by: avra on August 03, 2021, 08:33:46 pm
Tako a look at JVCL and pl_cindy which can be downloaded through OPM.

https://forum.lazarus.freepascal.org/index.php/topic,46586.msg332443.html
Title: Re: Enable designtime functionality at runtime?
Post by: heeb on August 03, 2021, 09:01:29 pm
Tako a look at JVCL and pl_cindy which can be downloaded through OPM.

https://forum.lazarus.freepascal.org/index.php/topic,46586.msg332443.html

Will do! Thank you very much  :)
Title: Re: Enable designtime functionality at runtime?
Post by: heeb on August 03, 2021, 10:40:15 pm
Tako a look at JVCL and pl_cindy which can be downloaded through OPM.

https://forum.lazarus.freepascal.org/index.php/topic,46586.msg332443.html

This indeed looks to be exactly what I need :)
Thank you so much!
Title: Re: Enable designtime functionality at runtime?
Post by: heeb on August 05, 2021, 06:04:39 pm
Tako a look at JVCL and pl_cindy which can be downloaded through OPM.

https://forum.lazarus.freepascal.org/index.php/topic,46586.msg332443.html

Hi Avra,

I was wondering if you could help me with the following:

I have successfully incorporated the Cindy component, and a TTIPropertyGrid as well.
I'm having some trouble with their interoperability though:

When the Cindy component is inactive, changes in the property grid are reflected in the component immediately. This is good.

However, when the Cindy component is activated, and I change something in the property grid, the effect of its new value on the component is not shown immediately but only when I then click on it / refocus the component.
I've attached a gif to show this.

I'm assuming this is either some property in the Cindy component I need to set to allow live updates while active, or a method in the Cindy component I need to call whenever a value in the property grid has changed?

Many thanks!
Title: Re: Enable designtime functionality at runtime?
Post by: avra on August 05, 2021, 07:47:37 pm
I have successfully incorporated the Cindy component, and a TTIPropertyGrid as well.
I'm having some trouble with their interoperability
I have not used such combination so I can not help directly. Maybe you can solve it by leaving cindy design mode when clicking on PropertyGrid? Or take a deeper look at how Cindy internally works and change it to your liking? I am not the author and my role was in making pl_cindy from CodeTyphon compatible with Lazarus. You can discuss the problem with original author at https://sourceforge.net/projects/tcycomponents/. As an alternative, you can try JVCL.

EDIT: In CyResizerDemo I see that selection is programmatically moved in design mode with this piece of code:
Code: Pascal  [Select][+][-]
  1. procedure TFrmCyResizer.SBResizerDownClick(Sender: TObject);
  2. begin
  3.   if RBMoveMode.Checked
  4.   then cyResizer1.MoveSelection(0, 10, CBIgnoreSnapToGrid.Checked)
  5.   else cyResizer1.ResizeSelection([reBottom], 0, 10, CBIgnoreSnapToGrid.Checked);
  6. end;
Have you looked at demos at all?
Title: Re: Enable designtime functionality at runtime?
Post by: heeb on August 06, 2021, 01:29:47 am
I have not used such combination so I can not help directly. Maybe you can solve it by leaving cindy design mode when clicking on PropertyGrid?

In the meantime I have indeed been experimenting with this approach, and it looks very promising.
I just need to temporarily store some info before leaving design more, and restore that upon re-entering it.

I am not the author

I understand, and I am already very, very grateful for the help you have offered.

Have you looked at demos at all?

Yes, I have, and that has also clarified a good few things.

Thank you again, I can now progress and create something useful!
TinyPortal © 2005-2018