Recent

Author Topic: [SOLVED]Component box  (Read 636 times)

ortegahernandes

  • Newbie
  • Posts: 4
[SOLVED]Component box
« on: February 24, 2020, 01:31:21 pm »
good morning everyone.

I don't program much at lazarus.

there is a box to place the components to be separated from the window graphic.

because they get in the way of adjusting the look of the window.
« Last Edit: February 26, 2020, 11:55:12 am by ortegahernandes »

Handoko

  • Hero Member
  • *****
  • Posts: 3907
  • My goal: build my own game engine using Lazarus
Re: Component box
« Reply #1 on: February 24, 2020, 01:52:22 pm »
Good afternoon friend!
(Here is not morning where I live)

I understand your problem, I sometimes have the problem too. But as far as I know, no there is no such container/box to store them.

howardpc

  • Hero Member
  • *****
  • Posts: 3581
Re: Component box
« Reply #2 on: February 24, 2020, 02:23:32 pm »
One solution is to add a datamodule to your app, which in your layout would show as a further tab.
Drop all your non-visual components on the datamodule, and make sure it is named in the uses clause of the form(s) that need those components.

Handoko

  • Hero Member
  • *****
  • Posts: 3907
  • My goal: build my own game engine using Lazarus
Re: Component box
« Reply #3 on: February 24, 2020, 02:25:23 pm »
Can datamodule store non data control components?
I never knew about it.

wp

  • Hero Member
  • *****
  • Posts: 7737
Re: Component box
« Reply #4 on: February 24, 2020, 02:28:30 pm »
The components which disturb you and which I see in your screen shot are non-visual components. Did you notice that the context menu of each form has an item "Show nonvisual components". Uncheck it, and these icons will be gone. This is a per-form setting, i.e. you can remove them only on crowded forms and leave less crowded forms unaffected. Note, however, that this setting may be confusing because you do not get a direct feedback that there are hidden components. Try to get accustomed to work with the component tree above the object inspector where every component is shown.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Handoko

  • Hero Member
  • *****
  • Posts: 3907
  • My goal: build my own game engine using Lazarus
Re: Component box
« Reply #5 on: February 24, 2020, 02:29:41 pm »
Thanks WP, I learned something new today.

BSaidus

  • Sr. Member
  • ****
  • Posts: 346
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: Component box
« Reply #6 on: February 24, 2020, 02:53:49 pm »
USE DATAMODULE
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

nouzi

  • Full Member
  • ***
  • Posts: 184
Re: Component box
« Reply #7 on: February 24, 2020, 04:01:57 pm »
you can use data module
my english is  bad
Lazarus 2.0.6 free pascal 3.0.4
Lazarus trunk  free pascal trunk 
System : linux mint 19.3 64bit  windows 7 64bit

lucamar

  • Hero Member
  • *****
  • Posts: 3208
Re: Component box
« Reply #8 on: February 24, 2020, 06:17:32 pm »
Using a DataModule is the preferred way but you have another possiblility: Add a Panel (or similar component) aligned to your preferred border with its Visible property set to False. Use that panel to drop the non-visual components and the rest of the form to design your UI, as shown in the attached image.

At run-time the panel will be invisible (and you can even destroy it in the form's OnCreate event handler) but at design-time it provides a convenient place to keep those components so thet they don't clutter the "normal" UI.

Of course, if you have a gazillion such components this won't work; this is what happens usually in DB-driven applications, hence the name of (and, beyond other issues, the need for) the special TDataModule, which despite the name can indeed host whatever component you throw into it.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Otto

  • Full Member
  • ***
  • Posts: 225
Re: Component box
« Reply #9 on: February 24, 2020, 07:20:44 pm »
Hello everyone.

I am trying to solve a problem that in some respects is superimposed on the one required.
So far, I have overcome similar problems by having the components created during RunTime.
Can the solution I use cause some unexpected behavior?

_______________

Note to ortegahernandes.
Surely the answers that have already been given are better and more relevant to your problem, compared to the solution proposed by me.


Greetings.
Otto
Kind regards.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3886
  • I like bugs.
Re: Component box
« Reply #10 on: February 24, 2020, 07:48:25 pm »
I am trying to solve a problem that in some respects is superimposed on the one required.
So far, I have overcome similar problems by having the components created during RunTime.
Can the solution I use cause some unexpected behavior?
No, you just need more Pascal code and loose the benefits of WYSIWYG layout.
Sometimes it may indeed be a cleaner and easier option. For example you may want to show a different set of controls in one area based on a setting, by switching their visibility. Using WYSIWYG you would place the controls on top of each other. Messy!
Pascal code is less messy then.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux.

ortegahernandes

  • Newbie
  • Posts: 4
Re: Component box
« Reply #11 on: February 24, 2020, 09:06:06 pm »
The components which disturb you and which I see in your screen shot are non-visual components. Did you notice that the context menu of each form has an item "Show nonvisual components". Uncheck it, and these icons will be gone. This is a per-form setting, i.e. you can remove them only on crowded forms and leave less crowded forms unaffected. Note, however, that this setting may be confusing because you do not get a direct feedback that there are hidden components. Try to get accustomed to work with the component tree above the object inspector where every component is shown.



Handoko  and wp


thanks for your tips.

Handoko thanks for the quick reply.

the "wp" tip was exactly what I was needing.

 

TinyPortal © 2005-2018