How to allow clicking on a pixbuf (image) in a treeview? - gtk

I want to make my gtk.CellRendererPixbuf in the treeview clickable so that I can call a function when user clicks on it. Is this possible and how can this be done?
I'm working with PyGTK, but answers in C or PHP or anything else would be acceptable. Thanks.

The C documentation of GtkCellRenderer states that:
Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be activatable like GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be editable like GtkCellRendererText, which allows the user to edit the text using a GtkEntry. To make a cell renderer activatable or editable, you have to implement the activate or start_editing virtual functions, respectively.
What is unfortunate is that this information is missing from the pyGTK documentation, but the information is available in the activate signal documentation.

Related

Visibility parameter of WPF control not visible with UI Automation?

I started writing test for a WPF application with FlaUI (UI Automation framework). Now I want to get the Visibility value of a couple of buttons.
These buttons are located on the same position in the WPF window. The first is a start button which will start a measurement. When clicked, the measurement button is replaced with a stop button. The visibility of these buttons are set in the code behind of the xaml and needs to be checked/verified.
With FlaUI I only get IsEnabled boolean and OffScreen boolean. But when using the Offscreen parameter, this boolean is not set or is set to the correct value for a couple of seconds but is changed again while the measurement is still running.
I also tried other ways, like looking for a clickable point of the not visible button. But those are not working.
Can this be done without extending the button class with an AutomationPeer and exposing a ValuePattern? I googled a bit but cannot find an (decent) answer. Hopefully someone can help.
I think an important part of your question is the word "replaced". Commonly a program draws one set of controls (in your case the start button) and later draws another set. Possible on top to hide the first, or possible by deleting them.
Commonly controls, including buttons, are drawn within other containing controls and so it may be that the button controls are not there at all, hence the visibility checks should be done on the parent or ancestor controls.
This Q&A seems related to the problem you are having and it may provide some more insight.

How to add custom format for selected cell in react-data-grid?

Documentation addresses only the event handling https://adazzle.github.io/react-data-grid/#/examples/cell-selection-events.
Are there any CSS classes that are assigned to the selected cell? Currently the selected cell has pale blue border but I would like to change this. Such change of style is not possible with ReactDataGrid.onCellSelected, because the formatter.render() event is fired first and only then onCellSelected event is fired. Yes, I can read the coordinates of the selected cell in onCellSelected, but I can not use those coordinates for formatting, because formatter.render() is executed before onCellSelected, i.e., coordintates of new newly selected cell are not available in the time moment when they should be read.
I do not consider this as bug, of course, there should be another mechanism how one can format the selected cell, but at present I can not find this mechanism in documentation. I went through the generated code in web console and I did not managed to find any additional class name that could have been added to the selected cell by the grid.
So, what is the right mechanism how to format the selected cell?
Maybe I can call (somehow) formatter.render() of the selected cell inside onCellSelected somehow? And that would solve my issue?

GWT - adding pseudo Anchor

Is there any way in GWT to get a pseudo anchor ??????
I just want to have TextCell or textColumn in a Celltable with underlined text onclick of which a dialog box opens. This is a simple requirement and i donno why i am still not able to figure out how to do this. If it was to be written in HTML this is hardly 2 seconds job.
And i do not want to use Hyperlink or Anchor which causes a page refresh which seems unnecessary for my requirement.
This looks more complex than learning Japanese to me.
ClickableTextCell is probably what you are looking for. You can quickly override it's render method to give the cell content the appearance you require, if the standard appearance is not suitable.
When the cell is clicked, the value updater of the Column that hosts the cell will be called.

Titanium - Custom Map Annotation Bubbles?

Is there any way to customize the map annotation bubbles in Appcelerator Titanium? Specifically, I'd like them to be able to display more text than what they show (ideally, by expanding to fit the text). I know I can make them clickable and take the user to a page with more info, but I simply don't have enough information to warrant that. It's basically just the title text is too long (and I can't change the text itself, it comes from sources I have no control over).
Alternatively (if customizing what's there isn't an option), is there an easy way to do custom bubbles? I don't really want to have to reinvent the wheel and rewrite the pins themselves and their event handlers, but if it comes down to it (and someone can point me to some code that can get me started, since I know if it's required, someone's done it), then so be it.
iPhone-specific options are fine.
At this moment the latest Titanium SDK gives you such possibilities for annotation bubble customization:
Add subtitle for the bubble (subtitle option). You will see additional text under the title. On Android subtitle can be multiline (using '\n').
Add left and right view to the bubble (leftView\rightView options). You can add custom view to the left or right part of the bubble. And view can consist of different elements (label, image...).
Read more here.
If this is enough for your task - you can use it. But for deeper customization you must create your own view and show it on annotation click event.

Large scrollview table with buttons

We are trying to write a training manual application for the iPhone. On the top half of the screen is a diagram of a car engine, on the bottom half is some text. At the user repeatedly hits a "next" button, we highlight different parts of the engine, and in concert we highlight different parts of the descriptive text below.
We basically want "living text" in the text half, with the illustration following along on top to where the reader is in the text. What we'd like from the text is 1. user can scroll it using their thumb so possibly a UIScrollView 2. the software can explicitly drive a scroll to any part of the text (when they hit the "next" button). 3. the words in the text are interspersed with hotlinks e.g. "this is the camshaft... this is the piston..." and the user should be able to click on any of the keywords like camshaft, piston, and have the diagram highlight that. (The problem is not highlighting the diagram, its capturing the click). The text would have 300~400 buttons/links/keywords and about 600 words of text.
Since this is fairly similar to using a web browser, we tried using Apple's version of webkit using a UIWebView and handleOpenURL to register a service back to the app itself. But Webkit for internal links a popup comes up asking permission to access that link. Every single the user wants to go to a link (in our case just an internal event that we'd intercept so that we can highlight e.g. the camshaft). Tried to intercept the event from the HTML view, but that didn't work.
It seems like the best we can do is to abandon scrolling text, and make the text part more like flash cards or a power point presentation, breaking the text into custom UIViewCells with buttons inside a UIScrollView. However, this would impose an annoying constraint on the author that they would have to write everything to fit in the UIViewCells, sort of chunky.
Any ideas would be appreciated.
This is definitely something you can use a UIWebView for. Don't use handleOpenURL, rather, set your viewController as the webview's delegate, and override -webView:shouldStartLoadWithRequest:navigationType:. When this gets called, check the request, and pull out your link data from there.
It would probably be easier to implement that completely in JavaScript in the document you load in a UIWebView. You would have to use JavaScript (i.e. [UIWebView stringbyevaluatingjavascriptfromstring:]) anyway to achieve things like scrolling to a certain position.