Workaround for making Gtk.Label a drag source? - drag-and-drop

I'm new to Gtk DnD, and I'm trying to make a Gtk.Label a drag source.
It seems it is not directly possible according to pygobject creating a drag and drop source
The workaround seems to be a surrounding invisible event box GtkEventBox (thanks #jku)
But the doc says:
"There is one unexpected issue for an invisible event box that has its window below the child. Since the input-only window is not an ancestor window of any windows that descendent widgets of the event box create, events on these windows aren’t propagated up by the windowing system, but only by GTK+. The practical effect of this is if an event isn’t in the event mask for the descendant window (see gtk_widget_add_events()), it won’t be received by the event box."
So, can I have a invisible GtkEventBox above my Label ?
If the GtkEventBox is below, does the GtkLabel catch events and bubble them up ?
Answer for me :
Surrounding the GtkLabel with a GtkEventBox works without any problem.
And the surrounded GtkLabel still receives the DnD drop events (with and without "visible-window"=False).
Since it worked, I havent played with set_above_child at all.

GtkEventBox was designed for handling input events for widgets that don't have their own GdkWindow. Put your label inside an eventbox and use the eventbox as the dnd source.
An HBox will not work because it has no GdkWindow either.

Related

Is RichEditBox in WinUI3 support ScrollView_Changeing event?

The RichEditBox controll in WinUI3 has scrollbar, but I don't know how to handle the scrollbar's changing event, and how to set position of the scrollbar.
In the visual tree I can see that RichEditBox contains a scrollviewer, can I get the scrollviewer and set its event handler?
Add a ScrollViewer to wrap the RichEditBox, deal with the ScrollViewer's event, I can get the scroll offset of RichEditBox. That match my question.
But, there's a nother question, how can I do the same thing for webview2? It dosn't work for webview2.

Call IgonrePointer on parent but not child

I am developing my first Flutter app and have a question that I'm not finding an answer to:
I have a static fixed area at the bottom of my screen. Various buttons will be shown here depending on the page. I am using a stack to place this area on top of the rest of the screen, with the page content scrolling underneath my buttons.
The problem I am having is that the button(s) is/are sitting inside of a DecoratedBox, which in turn is sitting in front of my page content. This means that this box is blocking me from clicking on anything below the fixed area (like the button labelled "Programs" in the image)
I have come across the IgnorePointer and AbsorbPointer classes, which allows me to set the decorated box to ignore events. The problem here, however, is that it also causes the buttons in this fixed area to no longer react to events, as they are of course children of the box that I am applying the Igonre/AbsorbPointer classes to.
Is there a way to make the parent decorated box ignore events but have it's children react to them normally?
(blue area must ignore events, and the button must react to events)
Any advice would be greatly appreciated
I think this link should help you solve your problem. I haven't tried it.
Flutter: How to make a ListView transparent to pointer events (but not its non-transparent contents)?

TinyMCE 4.x resize event

I've been searching around (both on SO and around the web) to try to figure out how I can get the current height of the editor after the user has resized it. The TinyMCE 4.x docs don't show any kind of resizing event. When searching around I did come across the ResizeEditor event but that seems to apply only when objects within the editor are resized (which makes it seem like a poorly named event). Despite that, I tried to listen to the ResizeEditor event just to see and it does appear to fire whenever I resize the editor (though, I'm unsure if that's because the actual editor is resizing or because elements within the editor are getting resized, too. In any case, only the event object is passed in as an argument to the listener and I don't see any way to get the editor's current height (after the resize) from that event.
So, is there a way I can do this? To listen to the editor being resized and get its height?
thnx,
Christoph
You should be able to get the entire height of the editor (Menus, Toolbars, StatusBar, content area, etc) with code like this:
tinyMCE.activeEditor.getContainer().clientHeight
tinyMCE.activeEditor.getContainer().clientWidth
When you call tinyMCE.activeEditor.getContainer() you are getting the outermost div that contains all that makes up TinyMCE. From there it is just standard JavaScript to get the relevant dimensions of that element.
Here is an example: http://fiddle.tinymce.com/qigaab/18

What is the difference between forceFocus() and setFocus() in SWT?

I don't quite understand the difference between these two methods. In what situation would forceFocus() be better than setFocus()?
According to SWT: The Standard Widget Toolkit, Volume 1, forceFocus():
Forces the control to receive keyboard
events. Controls that do not normally
accept keyboard input will take focus
using this method. If focus cannot be
assigned for any reason, false is
returned.
also:
Generally speaking, forcing focus is
something that you never want to do.
For example, forcing focus to a label
is not very useful because labels
don't draw in a manner that indicates
they can accept input. Forcing focus
to a control that does not expect it
can confuse users because they have no
idea where their keystrokes are going.
Application programs should always use
setFocus() to assign focus.
Coming in way late on this one, but I just finished a prolonged head-beating-against-wall session on something related to this and thought I'd do a quick report:
If your control has children, the setFocus(myControl) will do a depth-first search down the child tree and set focus to the lowest first child. On the other hand, forceFocus(myControl) will just set focus to myControl and have done with it.
I had a situation with a modeless dialog with a GridLayout, where most of the grid cells were a set of Canvas subclassed objects that needed focus. (Yes, this is a bit odd, but I wanted to be able to hover over a cell and type stuff into it.) The last control in the grid was a "done" button, which I set as the default selection.
When the mouse left the canvas cells, I was doing a setFocus(myDialogShell), which instantly set focus to the first canvas element, preventing the "done" button from receiving the \r and disposing of the whole sordid business. On the other hand, forceFocus(myDialogShell) did the trick.

Moveable Panels in GWT?

I need some panels in GWT that have moveable functionality. This is so that if you have a series of event-driven panels that have to be displayed on screen, they aren't all directly on top of each other. This can cause problems when you want to compare two different panels or want to close panels in your own order.
I'm currently using PopupPanels which as far as I'm aware, don't have this functionality.
I think what you want is a DialogBox. This class is a movable PopupPanel and has a constructor argument to create it as non modal, meaning if set to non modal mouse/keyboard events outside the panel are not ignored, but passed to the underlying widgets. This allows to open multiple DialogBox at once and being able to click on them or what's under it.
However, these panels can be moved inside the whole browser window and it's not possible to limit the movable area in the browser window. If you want such functionality you might want to look at the http://code.google.com/p/gwt-dnd/ library, which makes it possible to create movable panels inside a specific area.
Does your DialogBox refuse to be moved/dragged around? Make sure you DO NOT add() it into your RootPanel. Just create a new dialog and call show() on it.