Round Specific Corners of a Button in Flex - apache-flex

I want to round specific corners of buttons to create something like mx.controls.ButtonBar. But I cannot figure out how ButtonBar does this even after looking at its source. I thought the focusRoundedCorners css property was the answer but that applies only to drawing the button's focus box. Any idea on this would be greatly appreciated!

You can do this by creating custom skins for your buttons. Take a look at the source file in the Flex SDK for ButtonBarFirstButtonSkin.mxml (assuming you are using SDK 4). In a nutshell, when you draw the background/border/fill, you set topLeftRadiusX (or whatever corners you want rounded) on the Rect object. After creating your skin, assign it to the button in your CSS. Hope that helps.

Related

How to extract the canvas animation creator/trigger function from a website?

Here is a canvas: https://www.docker.com/#canvasCircle
I am thinking to use the function/images that creates this canvas. You can see that the circles are created first and then there is a ribbon like movement of the line from first canvas to last.
I have been trying to find either the images or the animation function. But couldn't. I would like to modify it and use it for my website.
In my case, as a front-end , I would use Photo Shop. Transfer everything to layers and extract the images. Than with css or Jquery , you can add :focus or :hover to make them pop or animate them. Not sure exactly what you want with it. With css you can also use transform etc. Hope this helps. It would help to know what exactly do you want the images to do so we can think of a code.

Custom shaped menu with shadow in Qt

I'd like to create a context menu looking similar to this one:
I read suggestions on the web that QWidget::setMask() should be used to create a shape. But how can it fit the variable number of items then? Moreover, the same menu item may take more or less screen space on different machines.
Another question is how to create a shadow around this custom shape? As far as I understand, the mask allows to crop the widget, but not to make it semi-transparent.
I don’t found an easy way to do that! But here goes a way!
Instead of using the Qt mask API, I've used a frame-less widget with transparency enabled!
To draw the shadow, I've used radial gradient!
You can change the size of the menu before opening it, however you can’t resize it after opened (for example resize with mouse).
It’s quite easy add or remove widgets, just respect the layout margin to not draw outside the bounds destined to widgets. To simplify your life I created an inherited class of QPushButton with colors you can easily customize with style sheet.
See the result:
You can browse the source
Hope that helps!

How to move a QPushButton inside gridLayout?

I have just tried a simple thing, in designer I created one push button, inside grid layout. The problem is geometry option got disabled in Property box, and I am not able to change the cordinates. In this situation how should I move the push button from its original place if required?
Can somebody help me to achieve this??
You can't move or resize a widget inside a layout because its position and its size are managed by the layout. If you want to manage its geometry yourself, do not use a layout.
Qt layouts are designed to help you make scalable user interfaces. For this, moving or resizing the button is usually done by the layout using sizeHint() and sizePolicy().
I would suggest reading up on how to use layouts and the use of spacers, as this will impact the location and size of your button.
Well I found a solution to that
Break the Layout, arrange the widgets and then set the layout

Glossy buttons in Flex 3

Any ideas how to create a button class that looks something like this:
Taken from this tutorial page. I'm struggling to figure out what combination of filters I need to use to achieve the glossy effect.
The rounded corners and bevel/glow effect are simple enough. But how can I add a gloss gradient over only the top half of the button?
Use this App --> http://jirox.net/AsButtonGen/
Found it. Degrafa has a Button Loader thing that does this exactly.
Open source too.

Flex Button with one color on left & another on right

I have a Flex button. I need one color on the left and another on the right. I don't need it to be a gradient. Just solid colors. Like green on left & red on right. I really don't want to use an image -- just because it'll probably take me a long time to do it.
The gradients via Flex Properties in Flex Builder seems to apply only vertically, not horizontally.
I also tried to make 2 button, each half width (of original), and putting it into a HBox & really packing them close so they'll look like a single button with 2 colors. It works OK, but I was thinking if there was a better way.
Thanks.
I think the proper way to do something like this is to create a custom component and then override the drawing method and draw in two colors, with the associated properties and such.
The solution you used is the simplest, so you should keep it like that unless you want to go through the trouble of creating the custom component (It's not THAT bad since Flex is open source and you can see how the original button is coded, and modify from there).
you could use degrafa to skin the button
This link http://blog.timeister.com/2009/01/16/flex-custom-button-skin/ provides a nice way to do exactly what I wanted above. It needs 2 classes: one subclasses ButtonSkin & the other Button. Link them both via CSS and use them in mxml. Simple & easy.

Resources