Recent

Author Topic: Design mode in compiled program?  (Read 5628 times)

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
Design mode in compiled program?
« on: August 08, 2014, 06:48:01 pm »
I'm converting an Excel VBA program to Pascal/Lazarus and am wondering if it's possible to programmatically select a visual component, such as TMemo from a menu, and drop it onto a form or stringgrid in design mode in order set the position, size, color, text, etc..  I suspect not because the underlying design code probably isn't compiled into the program.  "Introduction to Component Building" (for Delphi) by Ray Konopka discusses csDesigning in the ComponentState set.  It's easy to switch to design mode in MS-VBA programs because the code isn't really compiled and the program carries all the interpreting support with it - the biggest reason we want it compiled on cross-platforms.

HowardPC has shown me how to work around this very efficiently, but the users seem to like the VBA design mode method.  Can someone verify whether or not it can be done in Lazarus/FPC?

Thank you,
Gary
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

jdlinke

  • Jr. Member
  • **
  • Posts: 62
  • Just old me
Re: Design mode in compiled program?
« Reply #1 on: August 08, 2014, 07:07:00 pm »
Not sure I understand what you're trying to do. Place new components on the form at runtime and set size and other properties?
Lazarus 1.2.4 32-bit version on Windows 8.1 64-bit, Windows 7 64-bit, and Windows XP 32-bit

Currently developing TimberLog and the VirtualDBScroll Component Package

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Design mode in compiled program?
« Reply #2 on: August 08, 2014, 07:13:47 pm »
You can not drop a component programatically on the form, but can create it at runtime and set properties.

Your app knows nothing about the IDE.
« Last Edit: August 08, 2014, 07:27:57 pm by typo »

minesadorada

  • Sr. Member
  • ****
  • Posts: 453
  • Retired
Re: Design mode in compiled program?
« Reply #3 on: August 08, 2014, 08:37:07 pm »
It's also worth investigating the RTTI controls.  You can make a fake 'object inspector' at run-time using them.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Gary Randall

  • Jr. Member
  • **
  • Posts: 70
Re: Design mode in compiled program?
« Reply #4 on: August 08, 2014, 11:20:57 pm »
Thank you!  I'm attaching a snapshot showing some of the symbols I drop on the form.  The "Milestone Summary" is a memo with two diamond symbols added.  The "Float" line, callouts, triangle, diamond, rubber stamp, and pointer lines are some of the symbols used.  These are selected from a context menu and dropped on the schedule.  Clicking on them puts them in design mode so they can be positioned, edited, enlarged, and otherwise customized just like the IDE design mode.  It's really a CAD program to create schedules with symbols and notes added wherever desired.  Hope that clears up what I'm trying to do. 

Since the IDE isn't available in the compiled program I'm assuming design mode for components isn't either.  I will take a look at the RTTI components.

Gary
Windows 7 Home Premium 64 bit - SP 1
Lazarus Version #: 1.8.0; FPC Version: 3.0.4
SVN Revision 56594
i386-win32-win32/win64

avra

  • Hero Member
  • *****
  • Posts: 2586
    • Additional info
Re: Design mode in compiled program?
« Reply #5 on: August 11, 2014, 11:46:27 pm »
From CodeTyphon you can use runtime form designer and object inspector components:
In Windows example projects location is c:\codetyphon\CodeOcean\ExDesign\samples
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

tr_escape

  • Sr. Member
  • ****
  • Posts: 437
  • sector name toys | respect to spectre
    • Github:
Re: Design mode in compiled program?
« Reply #6 on: August 12, 2014, 08:11:16 am »
I want to share a simple sample for creating a component you can make your method in your software;

Code: [Select]
procedure TForm1.FormDblClick(Sender: TObject);
var
  x_btn : tbutton;
begin
  x_btn := TButton.Create(self);
  x_btn.Name := 'x_btn';
  x_btn.Parent := Form1;
  x_btn.Left := 50;
  x_btn.Top := 50;
end;

If you want to create another components you have to use your unit header for example: ex_cnts.pas etc.

But in this method you have to create your inspector window for all components etc. it has got little bit long way...


vfclists

  • Hero Member
  • *****
  • Posts: 1165
    • HowTos Considered Harmful?
Re: Design mode in compiled program?
« Reply #7 on: September 10, 2014, 10:02:57 pm »
From CodeTyphon you can use runtime form designer and object inspector components:
In Windows example projects location is c:\codetyphon\CodeOcean\ExDesign\samples

Can the CodeTyphon components be installed in Lazarus?
Lazarus 3.0/FPC 3.2.2

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Design mode in compiled program?
« Reply #8 on: September 10, 2014, 11:15:48 pm »
I have already tried some of them and they worked with out even any modifications(it was an older indy package), I guess the GUI ones might need a bit more work.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018