VB6 Rendering of Nodes in a Graph (with Hover over Connections)-VBForums
Results 1 to 3 of 3

Thread: VB6 Rendering of Nodes in a Graph (with Hover over Connections)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,077

    VB6 Rendering of Nodes in a Graph (with Hover over Connections)

    This cairo-(vbRichClient5)-dependent Demo will show (as the Title says) - how to efficiently
    implement a scenario, where you have to manage "connectable, draggable Boxes"
    (as in the Graph in the following screenshot):



    There's a green highlighted Connection (with an appropriate ToolTip), which can - (especially
    when the Path is complex) - often cause headaches with regards to: "how-to-implement".

    With cairo we have two nice calls available, which can help a great deal, when solving
    such more challenging "HitTest-problems":

    - cCairoContext.InFill(x, y)
    - cCairoContext.InStroke(x, y) <-- this one was used in the Demo

    So, what one basically has to do to accomplish a complex HitTest is, to simply apply the Path
    in question onto a CairoContext with the appropriate coordinates "as when truly rendered".

    Even better, such a cairo-context doesn't have to be derived from "something physically"
    (as e.g. a larger ImageSurface), a "virtual one" is already sufficient for that task.

    For that purpose (when working with the WidgetEngine, as in this Demo) - each cWidgetBase
    already offers such a context over W.MeasureContext.

    A slight problem I found was, that whilst CC.InFill always worked reliably, CC.InStroke was only
    delivering reliable Hits in 80-90% on the length of a complex Path (as e.g. the Beziers I used here,
    due to rounding-errors in the cairo-C-Source).

    Though I found a patch for that in the cairo-repo and backported that to the version (vb_cairo_sqlite.dll)
    which comes with the RichClient - in consequence CC.InStroke will now work equally reliable as CC.InFill.

    So the version of the RichClient (including the latest compile of vb_cairo_sqlite.dll) which will work
    well with the zipped Demo-Archive below, needs to be at least 5.0.24
    - please visit the Download-
    page at vbRichClient.com and update your package appropriately before running it.

    Here's the Demo-Zip:
    WidgetGraphConnections.zip

    Have fun...

    Olaf
    Last edited by Schmidt; Apr 15th, 2015 at 07:35 PM.

  2. #2
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    257

    Re: VB6 Rendering of Nodes in a Graph (with Hover over Connections)

    Nice demo. Maybe it would have been useful if we had had some additional features such as possibility to add/remove nodes or connections in real time but anyway the app offers a good base for other improvements. Thanks

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,077

    Re: VB6 Rendering of Nodes in a Graph (with Hover over Connections)

    The Demo is related to the Discussion here: http://www.vbforums.com/showthread.p...rogram-Testers
    and I plan to post an extended version here in this thread soon.

    But reexre has made some enhancements (draggable connections etc.) already on his adaption,
    where you could take a look.

    Olaf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.