Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Selection, selection rectangle ... ? (Read 3645 times)
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Selection, selection rectangle ... ?
Nov 29th, 2011 at 11:00am
Print Post  
Hello folks,

i have two "little" problems with selecting of nodes:

===

(A) when the user clicks around with ctrl-key pressed, he can add nodes to selection.
The shift-key does not do anything similar (like adding the span in between to selection), so i tried to do it programmatically.

Adding per
diag.Selection.AddItem(node);

does set the node as ActiveItem, but it does not get marked as part of selection (added) like it would per manual ctrl-click?

====

(B) Also, how does one disable the selection rectangle completely? I have some diagrams where selecting is disabled, so the selection rectangle does not show up on mouse drag over background, but in other diagrammes i would like to have selecting (per clicking), but not the (uncontrollable) selection rectangle.

I tried setting
ModifierKeyActions.Alt = ModifierKeyAction.Select;

in the hope that ONLY holding of ALT key would allow for select rectangle, but it happens all the same also without ALT pressed...

any suggestions please?

cheers
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Selection, selection rectangle ... ?
Reply #1 - Nov 29th, 2011 at 11:55am
Print Post  
Hi,

A. I am not sure what you mean by "sets node as ActiveItem, but it does not get marked as part of selection". Doesn't it appear in the Selection.Nodes collection, or aren't there selection handles drawn around the node?

B. With most Behavior types, there isn't a selection rectangle drawn unless you press the key assigned to ModifierKeyAction.Select. I think you can draw the selection rectangle directly only in the Modify and DrawLinks behaviors. If you need to use a behavior similar to them but without the selection rectangle part, you could do something like this:

- derive from either the ModifyBehavior or DrawLinksBehavior class
- override the StartDraw method
- check if the base class returned an InteractionState(Selection, Create) instance, and replace the result with null in that case
- assign your custom behavior object to Diagram.CustomBehavior

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Re: Selection, selection rectangle ... ?
Reply #2 - Nov 29th, 2011 at 12:06pm
Print Post  
ah thankx Stoyan, will try that.

I also solved (A) in the meantime, as the selecting was done within the NodeSelecting handler, it was probably cleaning up the selection frames in between, so i established another list ToBeSelected in which i reselect on MouseUp:

               if (ToBeSelected.Count > 0)
               {
                   foreach (DiagramNode node in ToBeSelected)
                   {
                       node.Selected = true;
                       Selection.AddItem(node);
                   }
                   ToBeSelected.Clear();
               }

and it draws nice select frames around

===

Only prob is, they are ugly black and rectangular (not following the shape) so i haev to fin dout how to make them e.g. red and oblong like the shapeNode is.

Shocked
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Selection, selection rectangle ... ?
Reply #3 - Nov 29th, 2011 at 1:03pm
Print Post  
Yep, NodeSelecting should be used only for validation, the control does not expect you to change selection state from the handler (it will change it again right after the handler completes depending on the e.Cancel value). Using the code above and changing selection from MouseUp should be safe.

You have a couple of options for changing the selection frame shape:

- set node.HandlesStyle to Invisible and use the node's Stroke and StrokeThickness properties to indicate selection state;

- or set HandlesStyle to Custom and draw the shape from the DrawAdjustmentHandles event handler;

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ulthien
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 91
Location: Munich
Joined: Nov 29th, 2011
Re: Selection, selection rectangle ... ?
Reply #4 - Nov 29th, 2011 at 5:00pm
Print Post  
- set node.HandlesStyle to Invisible and use the node's Stroke and StrokeThickness properties to indicate selection state;

thx, did that also in mouseup, adding effects as well and a stronger one for ActiveItem.

Keep on good work  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint