Recent

Author Topic: Is there a wiki article or some guide about converting a form into a component?  (Read 948 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 7910
Have there been changes in Lazarus which expose the properties of objects in frames to the objects since then? By that I mean at runtime.

If it didn't work would I really be telling you that it was the only safe way to do it?

After sleeping on this: there were very early code generation problems relating to frames, but those were fixed in FPC 2.7.1. I was using them heavily- in the context of notebook-style containers- by roughly 2010 according to comments in the project's source, and other than the problems caused by design-time instantiation have had no problems since.

I'd say that the overwhelming cause of "I can't access a frame's properties at runtime" are screwups caused by design-time instantiation.

There /is/, obviously, a possibility that something related to RTTI has (or at least had) problems. The only way to work that out is going to be by writing the mandatory standalone test project, which can be provided in compilable form for others if necessary.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

vfclists

  • Hero Member
  • *****
  • Posts: 1146
    • HowTos Considered Harmful?
I use an Object Inspector based component to set the properties at runtime and back then when I tried to use it to set the properties of objects on the frames it didn't work because they weren't exposed.

I don't know if things have changed since then as I replaced the frames with forms to gain that functionality.
That makes sense that there would be something like an object inspector that can be used at runtime. Can you show how you do it? I’m curious.
Also the properties of controls are usually accessible at runtime however the form is the only controls that is intended to be freestanding so maybe that’s why you can’t use frame for this.


Look at {$LazarusDir}/lazarus/examples/objectinspector/oiexample.lpi
Lazarus 3.0/FPC 3.2.2

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1184
Wow thanks, that was fun to play with  :D
I never knew oi could be used at runtime like this
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

 

TinyPortal © 2005-2018