q55x8x / Peronality-Creator

Sort of DevEnvironment for teaseAI personalities
4 stars 1 forks source link

Deplace cursor on ctl+click on target on screen #9

Closed png2 closed 9 years ago

png2 commented 9 years ago

When you ctl+click on a Goto that has a target in the current screen, nothing happens

The cursor should move to the target

q55x8x commented 9 years ago

This could be possible by using the textBox-control conversion between Position Point and Place and Screen. ( eg. txtctrl.PointToPlace... etc)

png2 commented 9 years ago

The problem is the click move the cursor back to where you clicked

I couldn't find a way to prevent the actual clicking action to happen

I could make it work by switching from clt+click to clt+B with the following code :

 if(e.KeyCode == Keys.B && ModifierKeys == Keys.Control)
            {
                var p = this.CurrentEditor.Selection.Start;
                if (CharIsGoto(p))
                {
                    string gotoName = Regex.Match(this.CurrentEditor.GetLineText(p.iLine), @"(?i)(?<=\@goto|then)\([A-z_0-9öäüáéíóú+\s]+\)").Value.Trim("()".ToCharArray()); //sadly there is currently no better way of  
                    int index = Regex.Match(this.CurrentEditor.Text, @"(?<=\n)\(" + gotoName + @"\)").Index; //jumping to a match :( then extract the index and
                    Range range = this.CurrentEditor.GetRange(index, index + 1); //getting its range
                    this.CurrentEditor.Navigate(range.ToLine); //to navigate to its line
                    this.CurrentEditor.Selection = new Range(this.CurrentEditor, range.ToLine);
                    this.CurrentEditor.Invalidate();
                }
            }
        }

If it's easier we could change the clt+click to a shortcut for now

q55x8x commented 9 years ago

For now if its easiert I think we should go for it and dont waste that much trying to get it right as I will try to rewrite the complete ctrl-click stuff in the mainFrm-rewrite.

q55x8x commented 9 years ago

fixed by using the MouseUpEvent instead of MouseDown event