How best to create a HMI display panel (user-customised interface) in Delphi - delphi

I need to improve a screen in our Application that presents an HMI (Human Machine Interface) display embedded in our Delphi code. This screen provides our customer with the ability to perform a range of actions (run test, product report etc) and to expose and view key named data values. This customisation is required because our Application controls machinery that might be operated by a range of skill levels from simple operator (may not speak English and must have very limited control) through to a power user who wishes to 'see everything' and have max control.
Some years back I created a solution based on an embedded HTML viewer (Turbopower's as it was then) and TPageProducer to dynamically tweak an HTML template (that the user could customise) and which would display a simple set of controls and data tables. This works fine but is slow to edit (you have to tweak the template and look-see the effect) and I'm sure there are better ways now.
What I need is similiar to a Delphi form that can be customised at runtime. I need: buttons, labels and edits. Editable shapes and arrows are desireable as are fixed images over which controls and text can be laid. The layout should be saveable (like a DFM file) and text labels should be of two types - fixed text and those which update to display key values on an update notification (like a DB control would). The final layout should zoom its scale to fit a resizable layout.
This question is about the best tool for the job and I'm not coming into this totally cold, I've experimented with Greatis Form Designer and obtained a working solution but before I commit, I would apprecaite comments about whether a report tool (with built-in report editor) would be possible / useable / better since a print dump feature would also be useful. (Fast Reports? Quick Report etc?). Note though that this is a display requirement primarily. Comments re newer embedded HTML solutions would also be welcome as would anything to ensure max future-proofing of the layout format.
Any solution should be useable in Dephi 7 (for now!) and does not need to be unicode as long as there is a migration path to this for newer Delphi's.
Any other comments or observations would be very welcome. Thanks.

Have you looked first at the free JVCL stuff? There's a JvInspector (RTTI component property inspector, just like Delphi property inspector), and a form designer, and so on. You could roll your own solution based on these, and even use JvInterpreter for some scripting capability.
Secondly, if you can support ANY control that you have, in your designer, and you need some HMI specific stuff, check out IOCOMP: http://www.iocomp.com/

TMS Scripter Studio Pro provides a Delphi-like IDE and form designer with scripting, but it maybe overkill for your requirements.

Related

How to implement a user definable interactive map in Delphi 2010?

I'd like to have an interactive floor map (so they're not huge) in my application. The maps will be different for every user, but contain similar elements which only differ by quantity and location. The application will show the map, identify certain elements and link them to information from the database.
To design and store the map, I'd rather not roll my own editor and/or come up with some custom file format. However, it would be nice if the format were open and easily readable. SVG seems to be the perfect candidate for the job. All there needs to be is a convention of how to name the elements to make them identifiable. But how to go from there? I need something that can render the SVG and distinguish between the different layers.
TSVG can do exactly this but depends on FireMonkey which I'd rather avoid - it's not even present in Delphi 2010, so I'd have to use another version and do DLL tricks.
Another option would be to use the Chromium Embedded Framework and create the map using HTML, CSS and JavaScript. That feels very bulky, and would be hard to get right.
Are there any simpler ways to do this that I overlooked, either using SVG or perhaps something completely different?
I'm not sure if a GIS system is appropriate for this. It may very well be overkill.
In the end I decided to go for D3.js using Chromium Embedded, to have a flexible and more portable solution.

Tabbed document interface in Delphi

I'm considering different user interface layouts for my next project and I was wondering if there are either integrated or 3rd party frameworks which allow me to create tabbed document interface?
To clarify, what I want is not some kind of docking mechanism or either an MDI interface but primarily a framework which allows me to have one main form and one or more secondary forms which will be shown as tabs inside the main form.
Though I said I don't want any kind of docking mechanism, I made a small test application that actually uses it. The result I got is very close to what I want. First, I miss some features like the close button on each tab. Second, I'd have to create some kind of framework of my own in order to automate all tasks, like creating and destroying the tabs, associating each new form with its tab, freeing the form when the associated tab is closed and so on. I'm not saying I can't do it but I'd like to know if there are any ready-made frameworks which already have all these features. Though I'd prefer an open source solution, a commercial one is also welcome.
Third-party components are not mandatory here.
You can use standard Delphi controls to obtain what you want:
Put a TPageControl on your form (from Win32 tab);
Set its Align property to alClient;
Right click on the control, then select "New page" to add a new page.
Then don't write your "tabbed" interface on forms, but on frames.
You can also create pages by code, displaying the frame inside each page.
I don't think there is any framework for tabbed interface, but for nice looking tab/page controls with close buttons on each tab, please check the following:
rkSmartTabs, it simulates Google Chrome browser's tabbed UI. and it's open source.
TAdvOfficePager, MS Office style.
Hope it helps.
I recommend using a tool bar(TToolBar or any similar) and frames(TFrame) in order to mimic tabbed interface, reason?! well Delphi is going cross platform(no secret in that) they will port most if not all of the standard VCL shipped with Delphi, so WHY NOT use this as an advantage?
Just create the frame(dynamically) when the user clicks on a button from tool bar and destroy the previous one(if exists) so you will keep memory usage at minimum, application startup/shutdown time will be very good, on the other hand, if you chose to use (cx)TPageControl, TAdvPager, etc. you might get caught in a situation in which one form(the main I suspect) will have so many VCL's that it will take a lot of UNNECESSARY memory and it will be slow.
Using frames has a lot of advantages, if somewhere in your application you need a "tab" to be shown, you can simply create the needed frame dynamically and use it without additional work.
Anyways, this is my two cents, hope this helps.
I recommend TvjPageList, which is part of the JVCL suite of components. It's open source and seems to fit your requirements.
I use JVCL JvDocking, and its tabbed docking system, to make MDI-like applications.
You can also float, or tile your windows, in addition to having them in tabs.

Draw and manipulate shapes at run time

What's the best way to draw shapes interactively at run time using Delphi? I need to be able to select, drag and resize the shapes. This will be used to mark up existing images and documents.
This looks like a good starting point, but I'm wondering if there's a more complete library (preferably free) available that will save some time.
Update:
If you're going with a custom solution from scratch, I've seen another example on Delphi Central that might be an even better starting point.
I will recommend you, read some links on my site. Are explained and all the source code is available; You can see and get some usefull for you.
Plugin system in Delphi - Part 2
Not directly what you need, is a plugin system for Delphi. But all the samples are based on a drawing tool that uses Shapes (Creating, selecting, resizing). You can review the code and extract what you need.
Sample manipulating of "Maps and Figures"
Sample of how to create, select and move components at runtime (in this case with TImage).
- Select shapes visually: Shows different ways to select shapes visually.
The web is in Spanish, but you can generate an authomatic translation on the web itself.
Anyway the code is commented.
Regards.
Excuse-me for my bad english.
One freeware option would be TssControlSizer. Just change the "control" property to the control you want to manipulate resize/move.
Not sure if you've moved on now with this Bruce but if you haven't, it might be worth looking at TMS Components Diagram Studio - it's certainly cheap, and looks quite powerful from the demo.
I would use Flex Graphics (commercial, $499 for one developer, with sources, $1500 for site-license, with source code). When I bought it, it was a lot less than that. So I guess, I wouldn't pay that now. It's a lightweight 'drawing/cad' package.
But as I already own it, I could import a page from the original document as an image, perhaps rendered in PNG or WMF, and then mark it up with lines, etc.
You could think of it as a light "cad" package. It has most primitive shapes, and you can easily create your own new objects or shapes in Delphi classes, that could be "smart shapes" like the ones in Visio.
http://www.flex-graphics.com/
Another commercial component set that I have heard only good things about is TRichView. They have a TRichViewEdit that looks like you could emulate a document markup environment easily with it.
Please check here:
TCAD -2d graphics component for delphi
http://www.codeidea.com
wish can help you.

Seeking floorplan design VCL toolbar

I'm looking for a VCL component for C++ builder. It should preferably have a toolbar with drag & drop functionality.
I want to define a building or area (which might not be rectangular) and split it into "rooms" (or areas, or whatever you want to call them). And I want to be able to put "doorways" (or passages, etc) from a room into its neighbours.
is there such a thing? Preferably free.
Thanks.
In case anyone wants to know the answer, I have verified with TMS that the diagram studio can indeed do this.
Although they said "You can use TMS Diagram Studio for that, it’s not that complicated to create new custom blocks, like L-shaped rooms", so I still need to verify that it can handle triangles & lost parrots (polygons).
Not that it is specifically built for room designing, but my best guess is that it is the closes you'll get without having to create the components yourself. Anyway TMS have a component pack called Diagram Studio. This allows you to add functionality to your application that somewhat simulates that of Microsoft Visio and other programs.
I don't know if this was truly what you wanted, but even though I haven't tried it myself my guess is that you can create your own room and door like shapes to be placed. It might worth a look. Atleast the feature list has this:

Where should I begin when building a component?

I am looking to build my own component and have no idea where to begin. I have some Delphi books but they are old and outdated, and am looking for some recommendations on tutorials/books to help me do this. The component will be pretty simple, basically 2 labels and an image. I need hundreds of these in an array, so I thought a component would be the best route. The text will adjust based on width etc, and have some mouseover events. So basically, where do I begin?
I am using Delphi 2009, this will be a win32 app.
Thanks!
You can order Ray Konopka's book Dev. Custom Delphi 3 Components - PDF for 25$. It's a specialized book on the subject and very good for a beginner too.
The main principles behind developing components is:
Whether the component is visual or
not (Does it need a Canvas to paint on)
Does it need a window handle or not (visual or non-visual)
Once you answered those questions you can look at Delphi's source code for examples.
As far as I know, Delphi Component Design, by Danny Thorpe, is still the best book on the subject. Component design hasn't changed significantly in the last 15 years, so whatever books you have probably aren't as outdated as you think. There are three things to keep in mind while reading older references:
Names of certain units have changed. There's no DsgnIDE anymore, for example. It's DesignIDE instead.
Design-time code is strictly separated from run-time code now. This means you can't use DesignIDE in your component's unit, or else you're barred from using run-time packages. Older Delphi versions didn't have this technical restriction (although it's always been a legal restriction), so old code examples you find might need to change a little bit.
Strings are Unicode now, so as with all old code examples you find, there might be some invalid assumptions about character sizes that you'll need to recognize.
The biggest obstacle to writing components is that you're expected to use various protected members of the classes you descend from, but those frequently aren't documented, so you'll have to be much more willing to go read the VCL source code for examples of how various methods are used.
The easiest way to do what you want is to create a new form. Drop the labels and image and arrange them the way you want; if it suits your need, put them on a panel so they can be moved around as a unit.
Select all the components you want included (and including the panel if you chose to use one), and then click the Component item on the IDE's main menu, and select the "Create Component Template". (It's only enabled if you have selected components on the current form.) A dialog will appear asking you for a name for the new component, and the Component Palette page on which you want it to appear.
Take a look at this article, which describes how to build new components made up of a group of existing components.
Don't worry about your books being old.
Just about everything from the old days still works fine and what little doesn't is generally due to name conflicts or the addition of Unicode in the 2009 version.
They aren't Microsoft, they don't go breaking old code without good reason. In fact, take some code from the old DOS days--assuming it doesn't try to manipulate the screen it's likely to run with minimal fixup.
Don't worry about your old books! Since v3, Delphi hasn't changed much. This is why most of the programs compiled with D3 still compiles in D7 or even newer versions. And if it doesn't compile, probably you need to change a line or two, here and then.
I would recommend you to search other VERY simple components on Internet and see how they are made. Then make your own and post it here. Let other take a look at it and suggest improvements or spot bugs.
About your control's design:
1) maybe you DON'T need those two labels. You can just paint the text directly on the image. If you have lots of those components as you say, you may save a little bit of memory.
2) you may NOT want to have lots and lots and lots of images loading in one form. The overhead may be significant. What you can do is to load the pictures ONLY in images that are visible on screen - and you will put on screen ONLY 5-10 images (or whatever number of images you can show on the form without going out of screen). As the user scrolls down, you keep the same same TImage controls on screen but you load new (next) images in them.
3) You may not want to store labels and TImage in an array (I suppose it is an TImage because it seems you want to show them on the screen else you won't need labels - you need to explain your problem in more details if I got it wrong). But you can store a TBitmap and the text (that you want to display in labels) instead.
So, you may need to calculate how much CPU/disk overhead your hundreds of controls will create and how much memory they need. If you stay well under 1GB and the loading time is under 10 seconds, then it is relatively ok. IF not, you may want to think about your control's design before starting to actually implement it.
Hope this was helpful.
See ya.

Resources