Rank: Member
Groups: Member
Joined: 9/7/2008(UTC) Posts: 19
|
Hi, I have some troubles when use Undo/Redo in my application with TextVObject. I write test application to show this problem. First problem: - run app - press "Test" button - object of type TextVObject'll appear on MultilayerViewer - press "Undo" - object'll dissapear from MultilayerViewer - press "Redo" - object'll appear again, but problem is - I can't select it via mouse click. Second problem first like: - run app - press "Test" button - object of type TextVObject'll appear on MultilayerViewer. It draws without Resize and Scew action points (I disable them in code). - move object on MultilayerViewer via mouse - press "Undo" - object'll dissapear from MultilayerViewer - press "Redo" - object'll appear again, but problem is - object draws on MultilayerViewer with Resize and Scew action points that not working. Can you help me to solve this problems?
|
|
|
|
Rank: Advanced Member
Groups: Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hi, Quote:object'll appear again, but problem is - I can't select it via mouse click I looked through your source code and I found that you created your own layer. So after Redo you should select your layer again: Code:private void button3_Click(object sender, EventArgs e)
{
if (multiLayerViewer1.CanRedo)
{
multiLayerViewer1.Redo();
multiLayerViewer1.CurrentLayerIndex = 1;
}
}
To resolve your second problem I recommend you to look through all objects once again and disable resize and skew actions when you do Redo. |
|
|
|
|
Rank: Member
Groups: Member
Joined: 9/7/2008(UTC) Posts: 19
|
Hi, Tamila. Thanks for your reply, but I still have some questions.
Prb 1: You suggest select layer manually after Redo - my program use more than one layer, which of them I should select after Redo? :) And if you look in my sample programm you'll see that I select object on layer in CurrentLayerChanged event. This code works well except Undo/Redo. In Redo command you deserialize previous version, replace existing and invoke CurrentLayerChanged event when layer added on MLV, but without objects. Why you don't fire this event when objects appers on layer?
Prb 2: As you can see I disable resize and scew actions in DesignerChanged event. This code work after Redo command and disables this commands. I can't understand why points for these actions displayed on MLV when actions are disabled?
|
|
|
|
Rank: Member
Groups: Member
Joined: 9/7/2008(UTC) Posts: 19
|
I think I know cause of first problem. When UndoRedoTracking enabled in MLV UndoRedoTracker saves currently selected layer in _currentState.LayerIndex. But you save state when layer added, removed or changed. When MLV.CurrentLayer changed this events doesn't invoke. And when I call Undo _currentState.LayerIndex serialized with wrong index (-1 if there is one layer). After Redo you make current this wrong layer, and my layer not active and I can't select vObject on it :(
|
|
|
|
Rank: Advanced Member
Groups: Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hi, Quote:You suggest select layer manually after Redo - my program use more than one layer, which of them I should select after Redo? :) And if you look in my sample programm you'll see that I select object on layer in CurrentLayerChanged event. This code works well except Undo/Redo. In Redo command you deserialize previous version, replace existing and invoke CurrentLayerChanged event when layer added on MLV, but without objects. Why you don't fire this event when objects appers on layer? We looked through your code once again and found the reason of your problem. You should save state of control after layer creating. So in your code you should write thus: Code:private void button1_Click(object sender, EventArgs e)
{
var layer = new Layer("test layer");
var vObj = new TextVObject("Test!", "Arial", 24, new RectangleF(0,0,100,100));
layer.VObjects.Add(vObj);
multiLayerViewer1.Layers.Add(layer);
multiLayerViewer1.CurrentLayer = layer;
multiLayerViewer1.SaveState();
}
Quote:As you can see I disable resize and scew actions in DesignerChanged event. This code work after Redo command and disables this commands. I can't understand why points for these actions displayed on MLV when actions are disabled? Unfortunately, it is bug and our developerts will fix it in future releases. |
|
|
|
|
Rank: Member
Groups: Member
Joined: 9/7/2008(UTC) Posts: 19
|
Thanks, it was usefull for me.
ПС: извиняюсь за оффтоп, но как изменить имя пользователя???
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello,
Unfortunately you cannot change user name. |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.