hpwSimpleGraph

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Locked
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

hpwSimpleGraph

Post by HPW »

Just released initial hpwSimpleGraph 1.0:

http://www.hpwsoft.de/anmeldung/html1/n ... ook19.html

Based on the excellent free TSimpleGraph component 2.0
http://www.delphiarea.com
Thanks to Kambiz R. Khojasteh for this great component.
The plugin supports similar features as the demo-app from TSimpleGraph.

First implementation with seperate runtime-plugin discussed here:

http://www.neosoftware.com/forum/viewto ... hlight=nbr

Until support through future neobook releases you can simply rename the NBR to NBP for delivering.

As always testers wellcomed!
:wink:
Hans-Peter
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Post by HPW »

Just released hpwSimpleGraph 1.01:

http://www.hpwsoft.de/anmeldung/html1/n ... ook19.html

Variable: [hpwSimpleGraphDblClickAction] change to [RectangleName_DblClickAction]
Variable: [hpwSimpleGraphNodeDblClickAction] change to [RectangleName_NodeDblClickAction]
Variable: [hpwSimpleGraphLinkDblClickAction] change to [RectangleName_LinkDblClickAction]


Since it was late-night yesterday here some additional data:

Actionlist:

hpwSimpleGraphCreate = Append a SimpleGraph-Control to an existing NeoBook Rectangle object.
hpwSimpleGraphDelete = Remove a SimpleGraph-control previously attached to a Rectangle object.
hpwSimpleGraphShowGrid = Show or hide the grid of a SimpleGraph-control.
hpwSimpleGraphGridSize = Set the gridsize of a SimpleGraph-control.
hpwSimpleGraphNoZoom = Reset the zoom to 100 of a SimpleGraph-control.
hpwSimpleGraphZoomIn = Zoom in by 25 on a SimpleGraph-control.
hpwSimpleGraphZoomOut = Zoom out by 25 on a SimpleGraph-control.
hpwSimpleGraphZoomValue = Zoom to a specific value on a SimpleGraph-control.
hpwSimpleGraphNew = Start fresh with the simplegraph.
hpwSimpleGraphLoadFromFile = Load a graph from file in a SimpleGraph-control.
hpwSimpleGraphSaveToFile = Save a graph to file of a SimpleGraph-control.
hpwSimpleGraphLoadFromExe = Load a graph from Exe in a SimpleGraph-control.
hpwSimpleGraphPrint = Prints a graph on a printer.
hpwSimpleGraphExportToEMF = Exports the graph to EMF-file.
hpwSimpleGraphCut = Cut selected graph-objects.
hpwSimpleGraphCopy = Copy selected graph-objects.
hpwSimpleGraphPaste = Paste selected graph-objects.
hpwSimpleGraphDeleteObj = Delete selected graph-objects.
hpwSimpleGraphSelectAll = Select all graph-objects.
hpwSimpleGraphInvertSelection = Invert selection of graph-objects.
hpwSimpleGraphBringToFront = Bring selected graph-objects to front.
hpwSimpleGraphSendToBack = Send selected graph-objects to back.
hpwSimpleGraphLockNodes = Lock/unlock node-graph-objects.
hpwSimpleGraphLockLinks = Lock/unlock link-graph-objects.
hpwSimpleGraphEditProperties = Edit properties of graph-Objects.
hpwSimpleGraphLabelFormat = Set label format of selected nodes.
hpwSimpleGraphLabelAlignH = Set horizontal label alignment of selected nodes.
hpwSimpleGraphLabelAlignV = Set vertical label alignment of selected nodes.
hpwSimpleGraphMode = Switch to different modes.
hpwSimpleGraphInsRectangle = Switch to insert rectangle mode.
hpwSimpleGraphInsRoundRectangle = Switch to insert rounded rectangle mode.
hpwSimpleGraphInsEllipse = Switch to insert ellipse mode.
hpwSimpleGraphInsTriangle = Switch to insert triangle mode.
hpwSimpleGraphInsRhomboid = Switch to insert rhomboid mode.
hpwSimpleGraphInsPentagon = Switch to insert pentagon mode.
hpwSimpleGraphInsHexagon = Switch to insert hexagon mode.
hpwSimpleGraphInsLink = Switch to insert link mode.


Variables

[hpwSimpleGraphCommandMode]
[hpwSimpleGraphBackColor]
[hpwSimpleGraphGridColor]
[hpwSimpleGraphMarkerColor]
[hpwSimpleGraphShowGrid]
[hpwSimpleGraphSnapToGrid]
[hpwSimpleGraphGridSize]
[hpwSimpleGraphZoomValue]
[hpwSimpleGraphFontName]
[hpwSimpleGraphFontColor]
[hpwSimpleGraphFontSize]
[hpwSimpleGraphFontStyle]
[hpwSimpleGraphFontCharset]
[hpwSimpleGraphShowhint]
[hpwSimpleGraphHint]
[hpwSimpleGraphCursor]
[hpwSimpleGraphLabelAlignH]
[hpwSimpleGraphLabelAlignV]
[hpwSimpleGraphNodeBgColor]
[hpwSimpleGraphNodeBoColor]
[hpwSimpleGraphNodeDefaultText]
[hpwSimpleGraphNodeBorderStyle]
[hpwSimpleGraphLinkBgColor]
[hpwSimpleGraphLinkBoColor]
[hpwSimpleGraphLinkLineWidth]
[hpwSimpleGraphLinkDefaultText]
[hpwSimpleGraphLinkBeginStyle]
[hpwSimpleGraphLinkBeginSize]
[hpwSimpleGraphLinkEndStyle]
[hpwSimpleGraphLinkEndSize]
[hpwSimpleGraphLinkLineStyle]

[RectangleName_KeyDownAction]
[RectangleName_DblClickAction]
[RectangleName_NodeDblClickAction]
[RectangleName_LinkDblClickAction]
Hans-Peter
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Post by dpayer »

Thank you Hans Peter. Your generosity is appreciated.

This would open up many graphical opportunities for NB! The demo demonstrates a lot of power in this plugin.

David P.
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Post by HPW »

The thanks has to go to Kambiz for his great free component.
This 1.0 release reflects the function of the official demo of TSimpleGraph.
When I ran across it, I thought it would be a good fit in the neobook toolbox.
Hans-Peter
User avatar
DELCO
Posts: 135
Joined: Fri Apr 01, 2005 9:12 am

Post by DELCO »

Thanks Hans !
I do appreciate every work done to improve NBK possibilities !
Have a good day !
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Post by Gaev »

Hans-Peter:

Just downloaded latest version ... and this time I installed and tested (sample) pub ... I echo David P's sentiments ... nice plugin with many uses for NeoBook developers ... especially liked how images can be displayed inside shapes (triangle, rounded rectangles, ellipses etc.)
Until support through future neobook releases you can simply rename the NBR to NBP for delivering.
... wasn't too sure of this ... the .nbp file is 343 KB and the .nbr is 321 KB ... what does .nbp have that .nbr does not ? ... and if you don't rename, is there anything more than the 22 KB penalty ?
As always testers wellcomed!
... not really a bug ... but a deficiency in NeoBook re: Embedded Files ... the list is not "portable" ... so when developers have NeoBook installed in a folder other than yours, the Book >>> Embedded Files ... stuff has to be redefined for your sample pub ... otherwise hpwSimpleGraphLoadFromExe does not work.

Wonder if anyone has asked original author for enhancements like ...

- background color gradients (horizontal, vertical or circular bands of colors)
- display background images with special effects (like fish-eye, gaussian blur etc.)
- text rendered at angles (other than horizontal)
- save to files other than emf format (png/jpg)
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Post by HPW »

Gaev,
... wasn't too sure of this ... the .nbp file is 343 KB and the .nbr is 321 KB ... what does .nbp have that .nbr does not ? ... and if you don't rename, is there anything more than the 22 KB penalty ?
This time it has not so much wizards. In fact 4 small dialogs are included.
So here it is not more than the 22 KB penalty.
But for me it is a first test to build such function without much developer overhead. So I learned new things about compiler directives and I can now switch from one source to both options. Thats the way to go for other plugins. And when it gets to Non-VCL plugins, then the differents becomes >300KB.
... not really a bug ... but a deficiency in NeoBook re: Embedded Files ... the list is not "portable" ... so when developers have NeoBook installed in a folder other than yours, the Book >>> Embedded Files ... stuff has to be redefined for your sample pub ... otherwise hpwSimpleGraphLoadFromExe does not work.
See my posthere:
http://www.neosoftware.com/forum/viewtopic.php?t=13566
So at least it is on the list! :wink:
Wonder if anyone has asked original author for enhancements like ...
I do not know, but it seems he want to make a generic graphing-tool and not another image manipulation component. You may ask on the delphiarea-forum.
Last edited by HPW on Mon Mar 13, 2006 12:02 am, edited 2 times in total.
Hans-Peter
User avatar
dpayer
Posts: 1394
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Question on usage

Post by dpayer »

When I create an object in the graph and double click on it I get a panel to describe the attributes of the object. The first attribute is whether the item is linkable or not. Does this only apply to linking objects with the arrow/line tool?

Is there a way to associate NB actions with any of these graphical items that are created? For example, if one shape is clicked to set a variable? Or would we do that in a manner similar to a map of the image determining the value of the data (as in a web page).

David P.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Post by Gaev »

David P:
Is there a way to associate NB actions with any of these graphical items that are created? For example, if one shape is clicked to set a variable? Or would we do that in a manner similar to a map of the image determining the value of the data (as in a web page).
In Hans-Peter's sample pub, the button labelled Create Graph has this code (at the end of the click section) ...

Code: Select all

Setvar "[RSimpleGraph_DblClickAction]" "hpwSimpleGraphEditProperties [#34]RSimpleGraph[#34]"
Setvar "[RSimpleGraph_NodeDblClickAction]" "hpwSimpleGraphEditProperties [#34]RSimpleGraph[#34]"
Setvar "[RSimpleGraph_LinkDblClickAction]" "hpwSimpleGraphEditProperties [#34]RSimpleGraph[#34]"

hpwSimpleGraphCreate "RSimpleGraph" "[GraphXSize]" "[GraphYSize]"
... so you can specify a routine to be called to handle each of these events ... then examine the mouse position to determine the shape underneath it ... though I do not see any mechanism to define/identify "currently selected shape" ... would ne nice to have the plugin populate reserved variables with such information ... like your Grid plugin.

Hans-Peter:

hpwSimpleGraphEditProperties pops up a dialog box for the end-user ... however, its style may not match the rest of the (NeoBook) objects on the same page ... might be preferable to provide developer with (scripted) control of these properties ... I see some reserved variables but not sure how one would deploy them to change an individual shape's properties at run time via script.
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Post by HPW »

David,
When I create an object in the graph and double click on it I get a panel to describe the attributes of the object. The first attribute is whether the item is linkable or not. Does this only apply to linking objects with the arrow/line tool?
Yes.
Is there a way to associate NB actions with any of these graphical items that are created? For example, if one shape is clicked to set a variable? Or would we do that in a manner similar to a map of the image determining the value of the data (as in a web page).
Gaev is right with his RSimpleGraph_NodeDblClickAction.
But he is also right that it is of limited use for now.

Gaev,
... so you can specify a routine to be called to handle each of these events ... then examine the mouse position to determine the shape underneath it ... though I do not see any mechanism to define/identify "currently selected shape" ... would ne nice to have the plugin populate reserved variables with such information ... like your Grid plugin.
OnSelect there are some variabel populated for example [RSimpleGraph_SelText], but this might be not sufficient enough. Kambiz has provide a TAG property (Integer) for each object, which is empty in the moment. It's part of the programmer to use such field to build a unique identifier. When we want to use such a field, it has to be incremented each time an object is created. Deleted objects may leave holes in the numbering sheme. For now you could use the TEXT-property but you may want to use an emty TEXT.
..pops up a dialog box for the end-user ... however, its style may not match the rest of the (NeoBook) objects on the same page ...
For that reason they are called by script. So you have the control if you want to use them not. (The dialogs are the original demo-dialogs (D7) slightly modified to use them under D5.)
>I see some reserved variables but not sure how one would deploy them to change an individual shape's properties at run time via script.
hpwSimpleGraphLabelFormat
hpwSimpleGraphLabelAlignH
hpwSimpleGraphLabelAlignV

are an example how to set properties in one or more selected objects.
More of that might make sense.

I had to think about 2 kinds of commands. One for interactivly choosen objets and a pure code solution (without any selection). Also pure scripted content creation is on the wish-list.

For the integration into neobook might be more necessary.
Generic left,right and middle click action(edit and viewonly-mode?)

So 1.0 was a start on the base of the TSimpleGraph demo.
As always I see this as a living project which will get improved over time.
So don't resist and keep ideas flowing. :wink:
Hans-Peter
AlfB
Posts: 132
Joined: Sun Apr 03, 2005 12:43 am

Post by AlfB »

Thanks Hans and kambiz,
seems to be a good starting point to enhance NB graphics facilities.

ALF
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Post by Gaev »

Hans_Peter:
So don't resist and keep ideas flowing.
... there are many parallels between your hpwGrid plugin and this one ... each is better in some aspects ... so, to quote a famous plugin developer, always use the right tool (plugin) for the job ... having said that, you might look at providing for this plugin the same type of properties, methods and event triggers as you have for the grid plugin ... just think of each shape as a cell ... a cell with more features than plain text (shape type, background image/color, border color, not restricted to rows and columns nor common sizes and positions) ... that should keep you busy for the next ... few hours :wink:

With a comprehensive set of scripting commands, this can extend NeoBook in the deployment of applications for Diagramming, Org Charts, Business Charting ... even card games, puzzles ... and if composite images can be exported to jpg/png files, it can be the basis of an image builder application.
User avatar
HPW
Posts: 2571
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany
Contact:

Post by HPW »

Gaev,

yesterday I had a chance to have a look at a prerelease doku of the upcoming TSimpleGraph 2.1 and it seems that Kambiz had heard some of your wishes. As soon as it is released I will pick it up and will add some of the new features. With something like a new introduced 'UniqueID' a lot of things become easier.

http://www.delphiarea.com/forum/viewtopic.php?t=656

The bad news : Not in a few hours! :wink:
Hans-Peter
User avatar
Wrangler
Posts: 1531
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA
Contact:

Post by Wrangler »

Good job, Hans! Another item for the nb toolbox. Thanks for your efforts. :)
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
Locked