Insert an image inside a GtkLabel? - c

I would like to insert an image inside a GtkLabel but the <image> tag doesn't exists in Pango. I also tried to using the hacky way that consist of having a <span class="image"></span> and setting it a background-image via the CSS but class="" isn't a valid Pango attribute.
My question is: Is their a way to insert an image inside a label ? Not before or after but inside. Basically i would like to add emojis in my instant messenger messages.
I searched the web, and here but doesn't found a solution that fit my needs. :/
Thanks in advance for replies.

It seem that doing this isn't possible. The proper way to do it seems to be using a GtkTextView. For peoples that are running into the same issue of me, just run gtk3-demo → Text View → Multiple Views.

I posted some full code of Pango's handling of images here. Pango's image handling is very limited but might be able to handle your simple requirements.

Related

Gtk+2.0, How can i remove an attached widget to a GtkTable?

this is my first question on Stack Overflow,so I hope you can be friendly if I will make some mistakes.
I'm trying to learn a little bit of Gtk2.0 mechanisms. I'm a newbie with this library so I'm trying to construct a basic GUI.
I created a 230x150 window, attached a GdkPixbuf icon and learned how to trigger signals, in particular I'm interested on showing/hiding the icon on pressing of an arrow key.
I have achieved the objective of showing the icon but I'm not finding the way to hide this one. I looked at the documentation, but anything seems to be working.
I attach the code below so you can help me better. Thanks in advance for hints.
http://pastebin.com/iUJRc6hw
You should be able to hide the icon with gtk_widget_hide(app->icon).

how to work with button which is in div tag and u have to click without using xpath?

This is the interview question asked to my friend for which i dont the answer. Please help me.
Question:
"how to work with button which is in div tag and u have to click
without using xpath?"
Thanks
Mahesh
Use any other location strategy. The By class offers you a whole lot more possibilities than only XPath. XPath expressions are the strongest possibility, but they are also very slow and tend to get veeeeryyyyy long sometimes.
id
name
tag name
class name
link text
partial link text
CSS selectors
XPath expressions
This, more or less, is the order of location strategies that you should use. Use By.id() any time you can. If you can't, use By.name() etc. They are ordered from the most concrete (and fast and simple) to the most broad (and slow and complex).
Pick any one that suits the particular context. In your case, look for an id, name, or use a CSS selector.
You can find your element by link text.
driver.findElement(By.cssSelector(selector)).click();
using this code you can click on button without using Xpath.

Form with style

I'm using version 4.1.4
Is it possible to create a form having some fields with a background color ?
something like the next image.
Thanks
Alejandro
I wanted to put an easy answer to this one. This works with 4.1 too.
$form->getElement('yourfield')
->js(true)
->closest('.atk-form-row-line')
->css(array('background'=>'red'));
Of course there are many ways and styling of the forms is described here:
http://agiletoolkit.org/doc/form/styling
http://agiletoolkit.org/codepad/gui/formstyle

ExtJS Create a component like editor of stackoverflow

I want to create a component on ExtJS like the editor that have stackoverflow for ask question (only Bold and Emphasis buttons). I think that should be an extension of textarea but i dont know how to select text selected and how to replace with tags+text. Please give me some ideas.
Thanks
Markdown by John Gruber can be obtained from his site. You could use his documentation as a basis for creating your own plugin for the HtmlEditor.
If you're talking about the ability to use asterisks for bullets and such, in that mode StackOverflow's editor uses something called "Markdown".
Here's one example of someone trying to make a markdown-based textarea with preview in Extjs:
http://www.sencha.com/learn/Extension:Ext.ux.MarkdownEditor
If you look around for other Markdown-related editors, you might find some ideas. If you're instead looking for just an "Online Rich-Text Editor" there's plenty of those.
UPDATE 29-APR-2014: There's actually a project you should take a look at. It's called "StackEdit":
https://stackedit.io
It's an open source initiative to supply a markdown editing component. Not ExtJS based, but those who find this question may be interested in what they are doing it.
(I discovered it through one of SO's open-source-recruiting sidebar campaigns; advertising can be useful, apparently.)

WinForms "mini-windows"

I need to create some mini-windows, like the ones shown in the image bellow, in my winform main form.
It would be nice if they could be draggable, resizable, and, mainly, closable.
How can I approach this design? Has anybody already seen some control (with code available) implementing something similar?
alt text http://img716.imageshack.us/img716/5765/imagea.png
A normal Form works fine for this. Set its FormBorderStyle to either FixedToolWindow or SizableToolWindow as desired.
If you want to keep your floating windows inside your main window, use MDI (Multiple Document Interface). Here is a tutorial (Google can find you many more).
Have you tried just setting the FormBorderStyle property to SizeableToolWindow?
Is that what you're after?
You can create them as resizable and draggable custom controls.
You could use my example at:
http://hourlyapps.blogspot.com/2008/07/resizable-and-movable-controls-c-net.html

Resources