I'm trying to add Input Method supportto McCLIM so that it can input CJK in McCLIM, using input method client like fcitx.
To draw fcitx better, I want to get the cursor position of text editing area when it changed.
looks like this:
I found something called cursor-position/stream-cursor-position, but I don't know how to get the cursor/stream currently focus on. I have tried *standard-output*, but it failed.
How could I do this?
I know you're not using libx11, but I'd like just show you how libX11 do this.
Basically this is done by XIM_SET_IC_VALUES in the protocol. The values the spot location within a nested value of preedit attributes.
The spot is simply a X point (x, y). Despite of that, the point is a relative coordinates to the focus window. The focus window is also a part of ic vlaues, with property name XNFocusWindow.
If you don't set focus window, the client window that passed through XCreateIC will be used as the focus window.
XVaNestedList preedit_attr;
preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &nspot, NULL);
XSetICValues(ic, XNPreeditAttributes, preedit_attr, NULL);
XFree(preedit_attr);
Related
I have several shapes in LO Calc and I need those shapes to change their sizes when they are mouse clicked: the first click enlarges the shape, the second click restores the original size.
I'm trying to do this with a macro assigned to those shapes. My problem and my question: how to determine within a macro which shape has been clicked?
I know how to get the current selected shape:
dim doc as object
doc = ThisComponent
someVar = doc.CurrentSelection...
But a shape when clicked is not getting selected and this method is not working.
I tried to add a parameter for the event object to the macro:
sub ChangeSize( oEvent )
But this produces a message about wrong number of parameters.
Is there a way to detect the caller of a macro in LO Basic? Or maybe another way to implement size changing with a mouse click?
P.S. One can use a separate button for calling the macro and click this button after selecting the needed shape, but this way is less convenient.
EDIT: As I guessed below in the comments, the described task can be solved via the mouse and shape coordinates. The key points for the solution I found here:
How to get Document-Coordinates from a Mouse Click in an OpenOffice BASIC Macro
Instead of detecting the caller, assign a different one-line macro for each shape clicked event.
Sub ShapeClickedA
ChangeSize("ShapeA")
End Sub
Sub ShapeClickedB
ChangeSize("ShapeB")
End Sub
Related: LibreOffice macro showing simple TextBox shape
P.S. After answering, I realized you asked the linked question as well. How is this different, and is the other answer not satisfactory?
I have built a bokeh app that allows users to select windows in data and run python code to find and label (with markers) extreme values within these limits. For ease of interaction, I use the box select tool for the range selection. My problem arises when repeating this process for subsequent cases. After markers are placed for the results, they are rendered invisible by setting alpha to zero and another case needs to be chosen. When the new select box includes previous markers, they become visible based on the selection. How do I override this default behavior? Can markers be made unselectable? or can I add code to the customJS to hide them after they are selected?
Thanks in advance for any help!
There are a few possible approaches. If you just want non-selected glyphs to "disappear" visually, you can set a policy to do that as described here:
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs
Basically, for bokeh.plotting, pass
nonselection_fill_alpha=0.0,
nonselection_line_alpha=0.0,
as arguments to your plot.circle call or whatever. Or if you are using the low level bokeh.models interface, something like:
renderer.nonselection_glyph = Circle(fill_alpha=0.0, line_alpha=0.0)
But be aware (I think you already are) that the invisible markers are still there, and still selectable if the user happens to draw a box over them with the selection tool.
If you truly want only a subset of the data to be visible and selectable after a selection, I'd say you want to replace the data in the column data source wholesale with the subset in your selection callback.
I would like to highlight the first node of a GtkTreeView and give that node the focus. gtk_tree_view_row_activated () seems appropriate for what I am trying to do, but I couldn't figure out the arguments it takes.
Thanks in advance.
gtk_tree_view_row_activated() actually acts on just one cell. I wonder if you really want to Highlight the row or just select it. I.e. if you want to leave the highlight even if the cursor is on another line.
If that's the case, note that you can define extra fields in the underlying model, for example, if you have 3 fields for your data, you can add field 4 with a color. Then you can tell the renderer to use the color in field 4 (instead of giving the renderer the color immediately).
This example not only changes the background, but also the text color:
http://faq.pygtk.org/index.py?req=show&file=faq13.031.htp
For more sophisticated work, you can even modify the atributes on a cell-per-cell basis:
http://www.pygtk.org/docs/pygtk/class-gtktreeviewcolumn.html#method-gtktreeviewcolumn--set-cell-data-func
Use set_cursor method:
TextView.set_cursor(0,None,False)
0 = Index of the first row
I want to know if there is a way to hide cursor in Windows 8 Metro mode. I found
this answer, but then I don't know how to obtain the
"unique resource id" for the second parameter of the cursor constructor (below).
Window.Current.CoreWindow.PointerCursor =
new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, 1);
EDIT: Forgot to mention that I need to handle mouse events normally so the answer below of setting cursor to null will not suffice.
Set the cursor to a custom cursor but make it just be blank...this allows you to track it like being a normal cursor.
You can set the PointerCursor object to NULL. As soon as you move over something like a text box, it will reset it back though. So you probably need to handle mouse over events on various controls, to hide it. This all depends on your complete scenario tough.
Also, before setting it to NULL, you can save the value of the property (PointerCursor) and then when you're done, set it back.
I have SWT application that is a set of Groups that contain various controls including a StlyedText widget. They are all laid out using the Form layout.
I want to show a dialog directly below the caret inside of the StyledText. However, I have to position the dialog relative to the parent shell.
My first idea is to get the position of the shell plus the position of the StyledText plus the offset of the caret. When I try to get the position of the StyledText, it says 0,0 (I assume because of my layout choice, the Form layout). I don't see a good way to get the position from the FormData either (it appears to be computed).
I am able to get the position of the mouse cursor, but I would like to have it be right under what the user is typing.
Anyone have any ideas?
In order to get the actual postion, the function toDisplay() should be used. For example:
Point displayPoint = myText.toDisplay(sqlText.getLocation());
That gets me to the position of the Text. I then added the caret position in order to move my dialog window to the line of text that is being written:
Point caretLocation = myText.getCaret().getLocation();
Point calcPoint = new Point(displayPoint.x+caretLocation.x, displayPoint.y+caretLocation.y);
I then used that location to position my dialog window.