JavaFX and CSS Basic ?'s (regarding Checkboxes) - css

I have a couple questions regarding JavaFX (1.3) and CSS. First of all, when I create a CheckBox node and set its styleclass, I can't actually get the checkbox to show up. It just looks like a text-label. Do I have to specify something specific to actually get the checkbox to appear?
Also, what is the CSS class/id I would use to modify all checkboxes in a program?

Have you read the JavaFX CSS Reference Guide?
http://download.oracle.com/docs/cd/E17802_01/javafx/javafx/1.3/docs/api/javafx.scene/doc-files/cssref.html

I think the place you need to look at is this forum post:
Styling a checkbox and also:
Checkbox in the UI controls
I had similar issues with ListBox where the control is constructed from a number of components and has a bunch of different pseudo classes to be 'configured' depending on what you need it do look-like.
The Styling a checkbox thread points you to the javaFX runtime: $lib\ext\jfxrt.jar.
If you look in: com/sun/javafx/scene/control/skin/
caspian/caspian.css
moderna/moderna.css
You get the full naked 'defaults' CSS for the your controls. That said I am on here today to find out
A method to algn JavaFX checkbox label text with the text on a line
... how to align the text base-line, so there's still work to do before it just magically looks right lol

Related

What kind of button does DatePicker and ComboBox use?

I have been trying to find the button that DatePicker and ComboBox uses. I have searched through ComboBoxBase, and all other similar classes, and have been unable to find it. Is there a public version of this?
There is no ComboBoxButton class or public method that creates such a thing. You can try to reproduce what's done in the specific controls by referring to the source code.
The look of the JavaFX controls are defined in their skin classes; so ComboBoxBaseSkin for ComboBox, with some supporting classes for the popup and list view that's displayed inside the popup. For the most part, the skin class defines the layout and behavior (i.e. response to user input), and the actual look (shape of the arrow, colors, etc) is defined by the CSS file.
These buttons are defined in a pretty non-trivial way; for ComboBox the arrow itself is defined as a Region, which is placed inside the arrowButton, which is a StackPane. Then the CSS file defines the shape of the arrow and different colors and borders depending on whether it's pressed, selected, etc.
The source for JavaFX is available via OpenJFX:
Home
ComboBoxBaseSkin
modena.css
In the CSS file, I would search for combo-box (there's a couple of dozen occurrences), and pay particular attention to the .arrow-button and .arrow classes.

Link jQuery-UI/Kendo-UI to make live changes to elements in page designer

I apologize if the title was not clear enough. I am working on a project where a user can design a page (something like Wix). I am continuing on a project left in-complete by some developer. The sequence of action is.
The user clicks on a link which adds an element on the page (e.g. textElement, picture, slider...)
There is an edit button for each element. Clicking which opens a dialog box.
On the dialog box there are sliders and color picker drawn using Kendo-UI. Using them the user can change the style settings for the element (e.g Font-Color, BG-Color, Font Size...)
What I want now is to apply/show the changes live on that element. I have the id available for each element. I can bind each of the style selectors and apply the changes live to the text element. But that does not seem the right choice as in future we might add another style selector in the dialog box, and that would mean adding the code for binding this new selector.
What I wanted to know was that is there an alternate or preferably easy way to do this?
Regards
Share some code with the basic idea that you follow, cause it's not getting clear what you did. It sounds like you can use the MVVM framework feature to help you for that.

How to create custom horizontal radio buttons with CSS?

I want to create radio buttons or other type of controls that will act like this:
[_value1_] [value2] [value3]
Value1 is selected, so it looks like pressed button or selected link (bold, no underline) and other elements are active buttons/links. When user select another value - state is changed. I can handle this event manually, question is - what plugin or existing css/js combination should I use to achieve this?
I am pretty sure that this type of controls have a name, but can't think out what is this. I have tried to search for custom style radio buttons, as functionality is the same, but failed. Also I have tried some other names such as switch buttons, but it's not what I want. It's also very similar to tabs, but tabs usually styled as something that require underline div attached. So I am looking for "radio button meet tabs" css/js solution.
Can you help me to name this control, if you know it's name, or find plugin/existing code that can help me to achieve my goal?
The question is not how to create this type of functionality myself, I can do it, but it's rather strange that there are no existing solutions and I want to help people in same situation, also may be existing solutions design can be better than I can invent myself, because I am not a designer.
Answer
This type of controls can be found as "Simplified CSS Tabs" or "CSS Mini Tabs", but they require some additional code to work as expected.
Also, this type of functionality can be found in Google as jQuery UI radio buttons transformed into a button set and Yahoo UI Button Control: Radio Buttons
http://jqueryui.com/demos/button/#radio
works done for ya bud :)

How to Remove Toolbar from QToolBox control in Qt?

How to Remove Toolbar from QToolBox in Qt?
Normal Toolbox looks like this:
I want to remove this button written with Page 1. Something like this :
I'm not sure if this makes much sense, since those buttons are needed for the functionality of the QToolBox. If you want a stack of widgets for which you can manually control if they are shown or not, then QStackedWidget provides similar functionality without displaying any elements of its own.
edit: No, as the QToolBox it doesn't come with a scrollbar. But since you 'fill' it with widgets of your own, which then are displayed with setCurrentWidget, you can use for example QScrollArea and placing your own widgets inside it.

Flex: accessing child through navigating the hiererachy

I have a generic function to build rows of controls (each row comprising of sliders, radio buttons, reset buttons, text display) etc, and some functionality to change underlying data based on these
As I didn't want to write specific code for each row, I had code written by which I can detect the row on which there has been a mouseevent, and though the row access each individual control
The hierarchy used is titleWindow (part of popup)->skinnable container->HGroup->control
When I trace for a radiobutton, I get the path as follows Electric_Modify.TitleWindowSkin2620._TitleWindowSkin_Group1.contents.contentGroup.0.RadioButton2645
The '0' before the radioButton stands for the first Hgroup id->named as 0
I tried accessing the radio button as follows- 5th element in the HGroup
((this.contentGroup.getChildAt(row)as Group).getChildAt(4) as RadioButton).enabled=false;
and get a message "Cannot access a property or method of a null object reference" on this line. How should I navigate the hierarchy to reach the element?
You should be using getElementAt(...) and not getChildAt(...).
The get element functions represent a "higher level" element hierarchy which is needed to make skinning easier.
((this.getElementAt(row) as IVisualElementContainer).getElementAt(4) as RadioButton).enabled = false;
It should look something like that, but the exact hierarchy depends on what's in your app.
#drkstr
Thanks for your input... I thought of an alternate approach that worked for me...I mapped out the parent of the HGroup via
parent1=hgrp.parent; and then referenced these buttons as follows
((parent1.getChildAt(row)as Group).getChildAt(4) as RadioButton)
This works like a dream...I presume your suggestion would let me jump across the intermediate layers
#J_A_X/ #Constantiner: Thanks for the suggestion. I have no idea why we didn't think through and go down the DataGroup path. Prima facie seems simpler... we got to creating the UI controls in MXML laying out controls serially,and when it came to making it generic, we literally replicated the MXML approach in AS. Started off easy, till it caused problems like above. We will fix this to a better approach, when we upgrade versions. It works for now

Resources