I have a ImageList assigned in Stateimages of a Virtual Treeview.
How can I change the stateindex of a root node? I can't find anything.
Thank you for your help.
You need to implement the OnGetImageIndex event. There you can set the var ImageIndex to the index of your image in the ImageList.
Should you need to only apply to root nodes, you can check if the nodes parent = nil.
From the help:
10.1.2.104 TBaseVirtualTree.OnGetImageIndex Event
property OnGetImageIndex: TVTGetImageEvent; Description
This event is triggered whenever the tree needs the index of an image,
be it the normal, the selected or the state image. The event should
be as fast as possible because it is at times frequently
called when the layout of the node must be determined, e.g.
while doing draw selection with the mouse or painting the tree. Kind
determines which image is needed and Column determines for which
column of the node the image is needed. This value can be
-1 to indicate there is no column used. The parameter Ghosted can be set to true to blend the image 50% against the tree
background and can be used for instance in explorer trees to
mark hidden file system objects. Additionally nodes are also
drawn with a ghosted icon if the are part of a cut set during a
pending cut-to-clipboard operation. In this case changing the ghosted
parameter has no effect. Notes Blending nodes can be switched by using
toUseBlendImages in TreeOptions.PaintOptions. Class
Related
For the context, I'm working with Capella, an Eclipse RCP application based on Sirius (hence, EMF, GMF and draw2d). This application is used for MBSE, that basically means diagram representations for industrial systems.
I'm developping an add-on (viewpoint) to display custom labels next to diagram elements. These diagram elements are, to put it simply, boxes inside boxes. My problem is that usually the label text is larger than the space between a box and its container, so the label gets hidden. What I need is these labels to always be in foreground. As I'm more used to web development, what I'm looking for would be the equivalent of the z-index CSS property.
Currently I have no idea of how to achieve this, I'm using a custom .odesign that allows me to control some rendering options, like labels text, the color of some elements or to add decoration, but I dont think its the way to go for my problem. Maybe I should use a custom EditPart or a custom StyleConfiguration (I already used these components for other projects) but I have no clue where to start for this issue.
Any leads will be greatly appreciated.
We recently did this kind of changes to keep some labels in Sirius Sequence diagrams always on top: the combined fragments are placed behind the lifelines (z order) but we wanted to keep the labels of the CombinedFragments visible event their bounds intersects Lifelines, Executions or States).
This has been handled in Bug 564239 for Sirius 6.3.2 (used in Capella 1.4.1).
You could find some hints the bugzilla (Gerrits and commits can be retrieved from the See also section).
In Sirius Sequence diagram , we use org.eclipse.sirius.diagram.sequence.ui.tool.internal.layout.SequenceZOrderingRefresher to control the z-order of CombinedFragments : all the figures that composes them comes from some expressions in the odesign, and synchronization with the Capella model for exemple.
But in your case you want to control only the label, so it must not be dealt on the edit par level, but on the figure one. The "overlay" layer and figure lead might be a good one.
Do not forget another thing: in GMF/GEF, the labels of an element is displayed/shown/rendered/visible if it fits to the visible area of the parent container: in the case of a node in a container with scrollbar, the visible are will impact the visibility of the sub nodes (extended to their border nodes, edges, labels, ...)
Regards
Maxime
Is it possible to place a port on a layer so that it is invisible when the layer is not visible?
I could not find an answer in GOJS documentation. I tested with this link template and it did not work.
myDiagram.linkTemplate =
$(CustomLink, // defined below
{ layerName: "blue",...
You can only put Parts in Layers -- either Nodes or Links or Adornments. In other words, you cannot split up a Node so that a piece of it appears in one layer and another piece of the same Node appears in a different layer.
The normal thing to do is to show or hide pieces such as ports, either by changing their visible property or their opacity property. The former causes the node's panels to be remeasured and rearranged; the latter does not. Several samples demonstrate this, including the Flow Chart sample.
Is there a possiblity to get the parent element of the current element.
Fx: I have a two column FCE and in this two column FCE I will place a custom image element. For performance reasones I would like to render the image only as big as necessary. If the special image elememt is in a two column element the image can be smaller as it must be outside of the two column element.
Until now I did not find a way to solve this problem.
Id of parent record is always stored in {record.tx_flux_parent} - however, you may need to manually transfer the {record} variable since this does not happen automatically.
Please help me to get the screen coordinates of the state icon rectangle of the given TTreeNode in a TreeView (I mean the icons specified in the TTreeView.StateImages property).
There is a TTreeView.GetHitTestInfoAt(X, Y: integer): : THitTests function, but that is not quite what I'm looking for; it says whether the given coordinates correspond to the label, or to the icon, or to the state icon of the item, but I need to know what part of the icon was clicked.
(The reason is that I want to implement the TreeView nodes with two checkboxes for each item, and I use StateImages to simulate the checkboxes (one state is a checked item, the other state is an unchecked item). As I understand, to know which one of the checkboxes is clicked I need to compare the cursor coordinates with the state icon coordinates. How can I get them?)
You can send the control a tvm_GetItemRect message which will tell you the client coordinates of the item's bounding box. Use that and what you know of the relative positions of the label text and the icons to determine where the mouse was clicked in the icon.
Instead of GetHitTestInfoAt, you might prefer to send a tvm_HitTest message instead since it will give you the hit-test information and an item handle at once; a handle is what tvm_GetItemRect requires.
You don't need the screen coordinates since all the coordinates involved so far are client coordinates, but you can call ClientToScreen if you really want screen coordinates.
I need to modify the focus-box's border color of TVirtualStringTree,
just like this pic:
You can't control the color of the dotted focus rectangle. That's determined automatically by inverting the color of whatever it's drawn on. The OS provides — and the tree control uses — an API for that. (You could edit the source code and replace calls to DrawFocusRect with your own function, if you want.)
If you're talking about the color of the whole node, then first check to make sure the toUseBlendedSelection paint option is set the way you want it. It defaults off, but since it makes the selection rectangle look cool when dragging a box around items, you might have turned it on without realizing what it does to ordinary selected nodes, too.
If that's not it, then adjust one of the values in the tree control's Colors property, probably either FocusedSelectionColor or UnfocusedSelectionColor. But please don't make such a change lightly; the user has chosen the selection color through the OS options, so you probably shouldn't change it. If you do use a different color, make sure the text is still readable against whatever new color you select.
You can set treeview's option toHideFocusRectangle to true and paint your focus rectangle by yourself in one of several paint events (basically it is enough to use OnBeforeCellPaint).