Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Inplace edit control (Read 7560 times)
Dexter
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Inplace edit control
Jun 25th, 2009 at 7:48am
Print Post  
Hi there!

I want to customize the edit control of a node in a diagram. I have implemented the createeditcontrol event and set the edit control on the event args to the control made by me. I have set the bounds to some values related to the node. In the enter inplace edit mode event handler the bounds of the edit control in the event args if modified, not the one I have entered.
The code in the create edit control:
CodeMaskTextBox control = new CodeMaskTextBox();
           control.Text = e.Item.GetTextToEdit();
           control.KeyPress += new KeyPressEventHandler(control_KeyPress);
           control.LostFocus += new EventHandler(control_LostFocus);


           int height = (int)(e.Node.Font.SizeInPoints * 3);

           PointF mousePosition = diagramView.ClientToDoc(Control.MousePosition);
         diagramView.DocToClient(e.Node.Bounds);


           rectangle.Height = height;

           control.Bounds = rectangle;

               e.EditControl = control;

after this code the bounds of the node is {X = 268.0 Y = 456.0 Width = 60.0 Height = 45.0} and the bounds of the edit control is {X = 357 Y = 607 Width = 80 Height = 21}

at the beging of the method private void diagramView_EnterInplaceEditMode(object sender, InPlaceEditEventArgs e) the node bounds is {X = 268.0 Y = 456.0 Width = 60.0 Height = 45.0} (the same) and the bounds of the edit control is {X = 357 Y = 560 Width = 80 Height = 19} ( the height and the Y position is modified).

please help

Regards,
Dexter
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #1 - Jun 25th, 2009 at 10:57am
Print Post  
Hi Dexter,

The node.Bounds coordinates are usually specified in millimeters, and the control coordinates must be set in pixels. I can see DocToClient called in your code, but the result is not assigned to anything? It should probably look like the code below?

Code
Select All
rectangle = diagramView.DocToClient(e.Node.Bounds);
rectangle.Height = height;
control.Bounds = rectangle;
 



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


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #2 - Jun 25th, 2009 at 11:16am
Print Post  
Hi!

sorry about that. the code there is like this:

int height = (int)(e.Node.Font.SizeInPoints * 3);
Rectangle rectangle =diagramView.DocToClient(e.Node.Bounds);
rectangle.Height = height;
control.Bounds = rectangle;

it was a mistake in my writing.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #3 - Jun 25th, 2009 at 1:15pm
Print Post  
Hi,

Is CodeMaxTextBox your own control? If you replace it with a Listbox, does the listbox appear where expected?

Code
Select All
private void diagramView_CreateEditControl_1(object sender, InPlaceEditEventArgs e)
{
	ListBox control = new ListBox();
	control.Text = e.Item.GetTextToEdit();

	int height = (int)(e.Node.Font.SizeInPoints * 3);

	Rectangle rectangle = diagramView.DocToClient(e.Node.Bounds);
	rectangle.Height = height;
	control.Bounds = rectangle;

	e.EditControl = control;
}
 



Stoyan
  
Back to top
 
IP Logged
 
Dexter
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #4 - Jun 25th, 2009 at 1:21pm
Print Post  
Hi,

Yes the CodeMaskTextBox is a user control of mine.
If i use the Listbox the placement is ok. Do you have any idea?

??? Cry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #5 - Jun 25th, 2009 at 1:42pm
Print Post  
Have you implemented your own Bounds setter? Or by chance Bounds might be set in response to some event raised by a child control?
  
Back to top
 
IP Logged
 
Dexter
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #6 - Jun 25th, 2009 at 2:03pm
Print Post  
no, i don't have any implementation done for the bounds setter. if you want I can send you the control to test it better?
about the other possibility, I do not know what to say. it is plausible but  ??? ?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #7 - Jun 26th, 2009 at 5:08am
Print Post  
Ok, please email the control to support@mindfusion.eu.
  
Back to top
 
IP Logged
 
Dexter
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #8 - Jun 26th, 2009 at 5:35am
Print Post  
I have send you the control! The mail subject is "Inplace edit control forum thread. For support to Stoyo". I hope it helps!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #9 - Jun 26th, 2009 at 12:39pm
Print Post  
Hi,

The control appeared where expected in our test app:
https://mindfusion.eu/_samples/CodeMaskTextBoxSample.zip

Try adding to it the properties and event handlers you are using to see what exactly changes its position in your application.

Stoyan
  
Back to top
 
IP Logged
 
Dexter
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #10 - Jun 26th, 2009 at 1:28pm
Print Post  
Hi Stoyan!

I have send you back an application with an example of what I have. In the application there are 2 table nodes (but the same happens if there are shape nodes). The one at the top of the diagram, the position is lets say ok, but at the one at the bottom is not ok! Take a look!

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #11 - Jun 26th, 2009 at 3:03pm
Print Post  
The custom control changes its position unexpectedly once DiagramView adds it as a child when running in your application, but we could not find any reason why this happens. As a workaround, move the node.Bounds assignment to a handler of the EnterInplaceMode event. It is raised after the control has been added, so setting the position from there works fine.

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


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #12 - Jul 23rd, 2009 at 7:05am
Print Post  
Hi Stoyo!

I have some links in my application where the in place edit is not important, so I do not need the edit control. Can I cancel the in place edit sequence for some of the diagram items?

Thanks in advance!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Inplace edit control
Reply #13 - Jul 23rd, 2009 at 7:09am
Print Post  
Hi,

You could set AllowInplaceEdit = false, and call DiagramView.BeginEdit(e.Link) in response to the LinkdoubleClicked event, only for links that users are allowed to edit.

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


I love YaBB 1G - SP1!

Posts: 62
Joined: Jun 25th, 2009
Re: Inplace edit control
Reply #14 - Aug 6th, 2009 at 2:17pm
Print Post  
Hi Stoyo!

I see now that is a node is inplace edited and the zoom factor changes the edit control of the inplace edit is position strange. It is a bug or I am missing something. You can test it on the DEMO application.

Best regards,
Dexter

C:\DocumentsandSettings\octavian\Desktop\situation.JPG
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint