I add two checkbox using java SDK. One uses AnchorString relative position, one uses absolute position. Somehow the one use absolute position just be invisible. The codes to create the two tabs:
Checkbox checkbox = new Checkbox();
checkbox.setTabLabel("chkLabel");
checkbox.setPageNumber("1");
checkbox.setAnchorString("관련");
checkbox.setAnchorXOffset("-10");
checkbox.setAnchorYOffset("-10");
Checkbox checkbox2 = new Checkbox();
checkbox2.setTabLabel("chkLabel2");
checkbox2.setPageNumber("1");
checkbox2.setXPosition("100");
checkbox2.setYPosition("100");
List<Checkbox> checkboxTabs = new ArrayList<Checkbox>();
checkboxTabs.add(checkbox);
checkboxTabs.add(checkbox2);
You need to assign the document on which you want the checkbox to appear on.
Use the property documentId that will contain the Id of the document on which you want the checkbox to appear on.
Source
Related
I'm working with a .NET WinForms form. I'm adding a new Checkbox control to the layout, but I need its text and checkbox elements to align with existing controls. Is it possible to bump out my Checkbox's checkbox element from its text element? Or am I better off creating a separate Label control?
thanks
Try using the following settings for your CheckBox controls:
checkBox1.AutoSize = false;
checkBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
checkBox1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
You will have to set the location and the size of the control yourself now.
Just create a custom (composite) control by adding a checkbox and a label. set the spacing as per need.
I am trying to add a new empty row at the beginning of grid on external button click. Grid is showing perfectly fine.
<wj-flex-grid #flex
[itemsSource]="data"
[isReadOnly]="true"
[headersVisibility]="'Column'"
[selectionMode]="'ListBox'"
(selectionChanged)="gridSelectionChange($event, flex)"
(loadedRows)="onGridLoaded($event)">
</wj-flex-grid>
and data using collectionView:
this.data = new wjcCore.CollectionView(records);
Using [allowAddNew] = 'true', It adds new row in bottom by default.
But I want to add at beginning on button click.
Updated:
addNewRow(ctl) {
this.data.addNew();
}
where addNewRow working fine but adding in bottom:
<a (click)="addNewRow(flex)">add new</a>
Please help how I can achieve this.
Thanks
To set the new row at top, wijmo grid provides a property newRowAtTop.
Modify your code like below:
<wj-flex-grid #flex
[newRowAtTop] = "true"
[itemsSource]="data"
[isReadOnly]="true"
[headersVisibility]="'Column'"
[selectionMode]="'ListBox'"
(selectionChanged)="gridSelectionChange($event, flex)"
(loadedRows)="onGridLoaded($event)">
</wj-flex-grid>
Note the [newRowAtTop] = "true" part in above code.
Following description of newRowAtTop is copied from this link:
Gets or sets a value that indicates whether the new row template
should be located at the top of the grid or at the bottom.
If you set the newRowAtTop property to true, and you want the new row
template to remain visible at all times, set the frozenRows property
to one. This will freeze the new row template at the top so it won't
scroll off the view.
The new row template will be displayed only if the allowAddNew
property is set to true and if the itemsSource object supports adding
new items.
How to make CodeNameOne Multilist component allow only one item selected each time and show a Radiobutton in each item to point this selection?
A list with RadioButton behavior.
IMPORTANT:
I need to do that programmatically (without using GUI-Builder).
You need to manipulate the underlying MultiButton components in the renderers. Try this:
MultiButton unsel = myMultiList.getUnselectedButton();
MultiButton sel = myMultiList.getSelectedButton();
unsel.setRadioButton(true);
sel.setRadioButton(true);
To get the behavior to actually be an "exclusive" behavior the model needs to only allow a single selection (FYI this will be WAY WAY WAY simpler with just using MultiButton in a Container and avoiding MultiList altogether).
Bind an action listener to the list and whenever the selection changes remove the "selected" attribute from the previously selected entry and then let the default behavior select the new entry.
I want to create a ComboBox having Checkboxes as children using Codename one.
I am not using the UIBuilder
For reusability I created a Container having three Checkboxes in it:
OverviewCheckBoxContainer
- Checkbox1
- Checkbox2
- Checkbox3
and this works already.
As it takes too much space on the screen, I now tried to add the CheckBoxContainer into a Combobox, like this:
ComboBox
- OverviewCheckBoxCont
-...
but it does not work, the ComboBox contains a single entry only and it's not a checkbox, but a text:
OverviewCheckBoxCont[x=...
(cannot see further on the screen)
How can I solve this issue, so there is a dropdown menu containing the three Checkboxes, that toggle onClick?
ps:
In the main form I added the CheckBoxesComboBox instead of the CheckBoxesCont:
this.add(BorderLayout.CENTER, checkBoxesComboBox)
instead of
this.add(BorderLayout.CENTER, checkBoxesCont)
1.You can use simple combobox as shown below
ArrayList al = new ArrayList();
findComboBox().setModel(new DefaultListModel(al));
2.And to add checkbox in combobox , you have to customize the combobox
3.Instead of customizing combobox, You can use button which shows and hides OverviewCheckBoxContainer which contains list of checkboxs
See this for customizing the ComboBox with the generic list cell renderer: https://www.codenameone.com/manual/components.html#_combobox
The problem with using checkboxes in a combo is that you would assume they would all appear in the combo as a set and the combo wasn't designed to do that. I would instead just use a Button and show a dialog with a set of checkboxes then set the text of the Button to match the result. You can style the button to look like a ComboBox if that is your preference.
I'm fairly new to infragistics and i need help -
i need to add a checkbox to every cell in my grid while still displaying the cell value and allow user to check/uncheck the cell-
for ex - my grid has many columns - text, datetime, numbers etc
each cell will display the text/date/number and also have a checkbox for user to check/uncheck that field
IS THIS POSSIBLE?
One possible way is to add an editor in the grid cells. For example, you can add UltraTextEditor with StateEditorButton (on the left or right as is better for your solution) in each cell like this:
private void UltraGrid_InitializeRow(object sender, InitializeRowEventArgs e)
{
if (!e.ReInitialize)
{
foreach (UltraGridCell cell in e.Row.Cells)
{
StateEditorButton checkBox = new StateEditorButton();
UltraTextEditor textEditor = new UltraTextEditor();
textEditor.ButtonsRight.Add(checkBox);
cell.EditorComponent = textEditor;
cell.Column.ButtonDisplayStyle = ButtonDisplayStyle.Always;
}
}
}
Keep in mind this will add many editors to your grid - bad performance. Other possible solution is to add via Creation Filter the check boxes to your cells.
Either way the main question is - how you will save the checked state back to your data source? If you have a boolean column for each column you actually do not need to add any check boxes. So think how you will save this information.