The class vtkInteractorStyleRubberBandPick allows selection of a rectangular window, when 'r' is pressed, and selection of a 1x1 window, when 'p' is pressed.
Is there a way to get the key that is currently pressed (the current selection mode)?
Is it possible to set the selection mode 'r' or 'p' in the code (i'm using pyqt and would like to choose the mode by checking a box in a gui)?
I don't speak python, so I don't know what extra obstacles you will have, but in c++ you could do this:
ad 1) the picking mode is not publicly accesible, it is represented by a protected variable CurrentMode (see the c++ source code). You would have to create your own class derived from vtkInteractorStyleRubberBandPick and define new public method for it that would return the mode.
ad 2) Again, not directly. But if you were to derive your own class anyway, you could also define your own method for setting the mode, as there is none. Without it, I suppose you could have your check box give focus to the vtk window and fire an R-key-pressed event...sounds overly complicated, but it would probably work.
Related
Is there any way to set the background color for certain lines in GoLand (JetBrains IDE) so I can sign what code I have read?
Is it possible to do this? Does not matter if it's an IDE function or via some plugin.
There are a few ways to mark some lines and add them to the "Reading" list:
Bookmarks. It is built-in functionality in IntelliJ-based IDEs. You can go to the line with Authenticator interface declaration and select Edit | Bookmarks | Toggle Bookmark in the main menu. All bookmarks are available in View | Tool Windows | Bookmarks.
3rd-party plugins. I'm aware of MultiHighlight plugin that supports selection of the piece of code.
Sticky selection can do that trick.
there is the brief intro about it:
you can mark a selection to be permanently highlighted, even when your caret moves away. Inspired by "Style token" of Notepad++.
You can define an arbitrary number of Paint Groups. Selecting the appropriate editor action (keystroke or context menu), the all occurrences of currently selected text will be added to the Paint Group and will be permanently highlighted (until you clear the selection with an other editor action). So you can have different text fragments to be selected with the same Paint Group. The Paint Groups are kept when IntelliJ is closed.
You can set different colours for each Paint Group
You can set a marker to be visible on the right side of the editor
You can add multiple selections to the same group
You can convert a Paint Group to multi caret selection (and thus edit, copy, delete, etc. it)
For convenience you can undo the last addition (until the document is edited)
You can cycle through each element in a given Paint Group or in all Paint Groups
Keymap actions are added dynamically for paint, clear and convert as you add more Paint Group
I'm using the Platform Behavior in Construct 2 for a Windows 10 game. In addition to the arrow key, I would like to use the Space bar to get the sprite to jump. Can I tell it to call into the Platform behavior somehow or get it to let me map space bar as well as up arrow to 'jump'?
You certainly can. You can use an action called "Simulate Control" to simulate pressing left, right, or up. So as your event, use Keyboard->on Key Pressed (Space Bar). Then for the action Player->Simulate Control (Up Arrow). This will allow you to press space bar to have your character jump. Additionally, you can turn off default controls for the platform behavior and do custom controls for left, right, and up using the same strategy.
The best way to go about doing this is by adding an event that handles the Space Button. Make sure to add the keyboard object in your layout, and in the event sheet, you want to make an event that handles the keyboard -> on key pressed (choose the spacebar when asked) -> choose whatever object you want to jump with the Platform behavior -> Set Vector Y to whatever increment you'd like to jump. Be sure to list this value as negative. The y-axis in C2 is inverted, so negative numbers mean up.
Hope this helps!
When I type "std::" in Visual Studio, I get a list of the members of the std namespace in an Intellisense dropdown. That's good; I like that. Then, pressing the down key will start to cycle through the elements in the dropdown.
But usually, when I press the down key with a dropdown active, I don't want to browse through the dropdown; I want to look at the next line of code. Is there a way to make that the default behavior?
I am aware that shift+down will perform the desired function (move to the next line).
I have a Visual C++ application where there are, among other things, a CListCtrl in the Main Frame and a Dockable Pane with a properties Window.
When I press the Delete key on the Properties Window, the application also understands it as "Delete selected item" of the CListCtrl.
Some similar behaviours occur for other keys.
How can I say that I don't want this to go also to the CListCtrl?
Ok, I made a PreTranslateMessage function in the Mainframe class, that puts the HACCCEL current accelerator table in a temporary variable when the input comes from the Properties Control or a descendent of it, then call the parent class PreTranslateMessage, and finally retake the original accelerator table in the end of this function.
Now, I have another question: Is this the best solution? Doesn't seem to me it is!
I want to make a simple paint program on visual c++ which allows the user to draw a path of a series of straight lines which follow on from each other. Once the user is done this, they should double click to stop drawing. It is important that I record the co-ordinates of the beginning and end points of each line of the path because I want to use this information to find the magnitude and direction of each line using simple math. Please can someone give me somewhere to start and any other guidance.
You should start with a tutorial in: MFC.
Learn the basics: Document/View architecture and
how painting is done (GDI and device contexts).
Basically, you should:
1. create an MFC application (SDI - single document interface),
2. Handle the OnLButtonDown (WM_LBUTTONDOWN), OnMouseMove (WM_MOVE), OnLButtonUp (WM_LBUTTONUP).
3. Maintain an dynamic array/List (TypedPtrList) of the points
4. handle the double-click event for detecting completion.
You should use the Invalidate() function on (after) each click, in order to see the changes
on the screen.
That's just a little bit of information to get you started
You'll want:
a class or struct to represent a point (if you make it a class, it could have computation methods that would, for example, calculate the distance and direction to another point)
a member variable: an instance of a container class (list, array, etc) to hold your points
a member variable: a boolean flag to represent whether you are drawing or not (starting with not)
and you'll need to handle:
the mouse click event to instantiate a point and add it to your container
the mouse move event to draw a line from the last point to the current mouse position if the drawing flag is true
the mouse double-click event to add the double-click location to your container of points and turn off the drawing flag
Yaron's strategy doesn't draw lines until 2 points are clicked. Mine uses "rubberbanding" to anchor the first end of the line then let the second end follow your cursor until you click to anchor it down. Use whichever one you like better.
if i were you i would use Qt.
Qt widgets are great for user interface. you should check qt examples...
if you want to make an image processing behind, you can use imagemagick library.
this library is great for any image manipulation.