How to implement a tooltip that supports HTML? - css

I'm using angular material, which has a neat tooltip, but it's not supporting HTML. So basically, just like a regular tooltip, when I hover over an element I want the contents of a component to appear on the right/left/top/bottom (wherever there is enough space available).
How can do that?

Related

How to make bootstraps's "split button" in Qt widgets

This is probably simple, though I can't find the correct CSS trick to handle this one.
I want to have this kind of button-group (separated with lines, containing a context menu ) in Qt. They must have native look and feel (not like below examples) so the only needed change seems to be removing rounded corners of a QPushButton from its right side (for left-most button), left side (for right most button) and both (for buttons in the middle).
Qt does not support this. You can use CSS to style the buttons like in the example, but you can not use natively styled buttons like this.
If you really need this, the only option I see is to write custom controls for this, with customized drawing code for each OS GUI style you want to support.
You could also try to use standard buttons that overlap and use custom code to paint some kind of line over the overlapping region, but I don't think that would be a good solution.

How to show table in alt message

I am creating a page in asp.net. I am trying to show some information in tabular format when user hovers on a inout button. To do this, I am setting alt attribute to input type button because it should be javascript independent. I tried creating a table and assigning it to the alt attribute as a text.
<input type="button" value="save" alt="<table><tr><td>some info </td></tr>
<tr><td>some other info </td></tr></table>"/>
But it is not displayed as a table with two ros. Instead it is displayed as a single line.
Is there any way to show it in tabular format?
This is not possible just like this. Alt can be just plain text.
You'll have to use JavaScript. Try to google for it :)
You'll have to:
Create table.
Using CSS, set it's position to absolute, near your control and display: none
On item hover, you have to set display: block.
Best for this kind of behavior is to use some Javascript framework, IE jquery
jquery.com
specially read these:
http://api.jquery.com/hover/
http://api.jquery.com/hide/
http://api.jquery.com/show/
Agreed with Ales, Javascript would make this a breeze. YUI's Tooltip allows you to instantiate a Tooltip associated with an element, or set of elements (changing the Tooltip's context, so in case you have many similar behaviours spread across a screen).
http://developer.yahoo.com/yui/examples/container/index.html
Once you have instantiated the Tooltip, its something like Tooltip.setBody("your HTML code");, though by default Tooltip sucks in title text of an <a> tag as its content, or possibly even alt text of an element - not 100% on the alt text default part though - good chance that if it doesn't do it by default, if you grab the alt attribute contents it will display it correctly inside the Tooltip.
Others have already told you that what you've asked for isn't possible, as HTML attributes must be plain text, not more HTML.
They've also told you that there are Javascript and JQuery libraries which will help you do what you're wanting to do. There are loads of scripts you could use, here's a link to one that you might want to try: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
However, I feel I should add one further point which others have missed, and which is actually quite important:
You're using the wrong attribute.
The alt attribute is not the correct attribute to use for a hover tooltip effect. You should be using the title attribute for this.
Using alt works this way for historic reasons in some browsers (I believe it works in IE, but not much else), but it is not intended as a tooltip. The correct use of alt is for a small bit of descriptive text that will appear if the image is not loaded. This could be because the file failed to load, or the user has images turned off, or the user has a text-to-speech browser, etc, but if the image is displayed, then this text should never be displayed.
The title attribute on the other hand is intended to be displayed, and all browsers implement it as a tooltip (in fact, it's not just on <img> tags; you can use title for any element).
Hope that helps.

Advanced Flex custom components for working with graphics and text

I'm looking for a new, modern components with enhanced functionality for working with graphics and text.
For example by mouse over to the text appears a icon click on that appears a panel into which you can change the font, font size, font color, letter-range, etc.
With graphics by pointing resizing handles appear, rotation, reflection, etc.
It sounds like you want to create a custom tooltip, that has the options to change/edit the appearance of the UIComponent that was hovered over. This is a tricky mofo of a component to make. I made a custom tooltip based on a Canvas, that has an item renderer associated with it. If your in earnest, I could probably put together a usable example and post it (on my blog or something).
If you hover over a component, a regular toolip appears, but when you hover over the tooltip, it expands out to a custom tooltip. I used Timer objects with event listeners added.
After that, you'll need to do all the transform stuff. Probably out of the scope of a single StackOverflow question to be honest.

Flex: TextArea attached Image

Is there any advance TextArea that can attached image(image is alligned with the text) and the image can be movable inside the text area.I know that text area can support html text and can insert image tag but it is very limited, I can't move the picture inside textArea by dragging it or even add events on it.Is there any approach or solution or suggestion that you can give me?Your help guys is very much appreciated.
It should be possible using the new(ish) TextLayoutFramework (TLF), that came with CS5 and Flash builder 4 http://labs.adobe.com/technologies/textlayout/
It has advanced location information for letter possitions, and also supports inline images more like the way html does.
Also look at the textflow options from this developer: http://guyinthechair.com/tag/flash-text-engine/
Seems like you would only need to add the interaction layer to achieve your desied results and it might be easier to use.
It sounds like you would need to build a custom component for that functionality. Dragging an image around a TextArea is very non-standard behavior.
Flex documentation on custom components
Examples of custom components including a custom TextArea
The solution is TLF (text Layout Framework).
With TLF you can use TLF markup to send formatted text and images to a TextFlow. It's very powerful, but also complex. Here is a list of the tags you can use:
http://blogs.adobe.com/tlf/2009/09/tlf-markup-overview.html
I created a HTML Editor using it, and I'm impress with it. It supports image resizing, drag-n-drop, advanced formatting, etc.
Hope this helps!

How can I use themeroller'ed styles in "regular" parts of a page?

I have a web app that I've recently applied a jQuery ThemeRoller theme to. Now I want to have a simple <h2> element have the same rounded-rectangular look as the dialog titlebar or datepicker title. How can I best apply these to my elements that aren't part of larger jQuery UI constructs?
I started down the path of just setting css class values manually based on what I could see inside Chrome's inspector tool, and I got part of the way there before I got nervous that this wasn't going to necessarily be the best way since I'm bypassing any css class assignment logic that might occur inside jQuery UI.
So, is there an easier way of applying those styles, or should I just go down the road of explicitly setting css styles on my headers?
There isn't any magic to the jQuery ThemeRoller CSS styles, if you look through the CSS files that it generates, you will find that they are generally clear and concise and easy enough to read.
The rounded corners in the ThemeRoller CSS will not work in IE, so you might not want to depend on them too much, but if you do, just apply the CSS using style='blah'.
stevedbrown's answer is quite correct.
You can apply rounded corners to any containing element by using the ui-corner- prefix. For example, to apply rounded corners to all four corners of a div element, you'd use ui-corner-all.
To only style the top corners of that same element, you'd apply ui-corner-tr ui-corner-tl for the TopLeft and TopRight corners.
Another possibility to the above is, if you know the CSS attributes you want to copy, you can do it programmatically like:
var defaultColor = $(".ui-state-default").css("color");
var defaultMargin = $(".ui-state-default").css("margin");
and apply these to your elements
$(".your-css-class").css("color",color);
$(".another-css-class").css("margin",margin);
etc
Kind of clunky, but it does allow your CSS developers to update the themerolled themes and you don't have to worry about updating any of your code anymore.

Resources