Combobox and checkbox in jexcelapi
Hay Gays,
with Writing Spreadsheets i want to cells which contain combobox and other cells which contain checkbox ,i need help with that i tried alot of things ?
You simply write your own TableCellRenderer that returns a different Component instance for each row.
It could do this by having three TableCellRenderers installed in it and it simply delegates the call to getTableCellRendererComponent to the appropriate renderer:
public class CompositeTablecellRenderer implements TableCellRenderer
private TableCellRenderer[] cellRenderers;
public CompositeTablecellRenderer()
// create your nested renderers here
public Component getTableCellRendererComponent(...)
TableCellRenderer renderer = cellRenderers[row % cellRenderers.length]; // For example!
return renderer.getTableCellRendererComponent(...);
}It's up to your application to determine which renderer to use for which row. Cell editors create another level of complexity but it's still achievable (I wrote one that mapped Class to TableCellRenderer so it could determine the renderer based on the value's class at runtime - it sort of works but subclasses prove tricky).
Hope this helps.
Similar Messages
-
I have a datagrid filled from a RO. There are a bunch of form fields outside of the Datagrid. When I press on a record the fields get filled in. That works perfect. One of the fields is a combobox. So I change some things in the fields and do an update. I update a DB and also use the itemUpdate to keep everything matching the screen to the DB. When I click to another record and then back the fields are changed and most all is perfect. The only thing I cannot do is get the Checkbox to Update. I press on the checkbox press an update button and the click to another record and then back and the checkbox does not show me if I selected "true" The DB updates just the Checkbox does not represent the data.
This is fired when the update button is pressed:
public function updateVehicle():void {
if (mainList.selectedItem !== null) {
vehicleList.setItemAt({ID:ID.text, Vin:Vin.text,
State:State.text,
Plate:Plate.text,
BrandID:BrandID.text,
BrandID2:BrandID2.text,
DrCheck:DrCheck.selected,
PsCheck:PsCheck.selected
}, mainList.selectedIndex);
sendFormdata();
var currentlySelectedItem : Object = mainList.selectedItem;
currentlySelectedItem.Vin = Vin.text;
currentlySelectedItem.State = State.text;
currentlySelectedItem.Plate = Plate.text;
currentlySelectedItem.Brand = BrandID.text;
currentlySelectedItem.Brand2 = BrandID2.text;
currentlySelectedItem.DrCheck = DrCheck.selected;
currentlySelectedItem.PsCheck = PsCheck.selected;
vehicleList.itemUpdated(currentlySelectedItem);
Alert.show("The database has been updated.")
DrCheck and PsCheck are the id's of the checkboxs. the Brand and Brand2 are comboboxs (works great) and the rest are textinputs. I know I asked a very similar question the other day. Once you get one thing (2 days) 5 minutes goes by and stuck again. If I didnt love CF and Flex so much Id hate it.
Thanks
GeorgeOn my original post has the update function that gathers the fields data to send to an update function, the second half of the function does the the itemUpdate. The BrandID and BrandID2 are for the comboboxs and the DrCheck and PsCheck are for the Checkboxs:
<mx:ComboBox id="BrandID" prompt="Select a Brand" dataProvider="{newBrands}" selectedItem="{BrandID.text}" labelField="label" width="150"
themeColor="#73B9B9"/>
<mx:CheckBox label="Pending" id="DrCheck" themeColor="#73B9B9"/>
When the program first loads I can pick in a DG and it changes the ComboBox to match whats in the ArrayCollection. That part is working. The Checkbox does not. Seems like I have it right, just does not get the true false values back into the collection. So when I make a change like check a box and press update the DB updates but if I leave the row and then select back on the first record the checkbox is always false, unless I reload all the data.
Thanks
G -
Is it possible to have sorting by group and checkboxes in the same ALV
Hi there,
Does anyone know whether it is possible to have sorting and group on one field in ALV and checkboxes set on another field in ALV?
eg.
Fieldname
===========
Name----
Text
Allowance----
Numeric -> Sort & Group
Verified----
Checkbox
How do I code it if it is possible to have grouping and check box all in one ALV. Meaning I want some data that are the same to merge using sort, while still having the checkbox available for my other field (Verified).
Thanks in advance.
Lawrencehi,
GROUP BY clause is used on database tables with select statement.
sort is used on internal tables.
can u clearly explain y u need group by and sort on the same field.
if u are extracting from dbtable using grou by clause on a field, then no need to sort it again.
if u want sort u can do it by giveing "sort itab by field". thats not a problem.
now coming to check box.instead of using SLIS type field catalog, u use LVC type.
in LVC_S_LAYO, u can fine box_fname.
while defining layout, u declare a variable of type LVC_S_LAYO
AND GIVE BOX_FNAME = internal table field name -
Castom ComboBox and lose binding
Hello. I'm trying to write my own ComboBox and I ran into a problem.
public class TestComboBox : ComboBox
public static readonly DependencyProperty SelectedCarProperty = DependencyProperty.Register("SelectedCar", typeof(string), typeof(TestComboBox), new FrameworkPropertyMetadata(null, OnSelectedCarPropertyChanged));
public TestComboBox()
this.Cars = new ObservableCollection<string>() { "Select Car", "BMW", "Mersedes", "Audi" };
this.ItemsSource = this.Cars;
this.SelectedItem = this.Cars[0];
public string SelectedCar
get { return (string)GetValue(SelectedCarProperty); }
set { this.SetValue(SelectedCarProperty, value); }
public IList<string> Cars { get; private set; }
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
base.OnSelectionChanged(e);
this.SelectedCar = (string)SelectedItem;
private static void OnSelectedCarPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
var car = (string)e.NewValue;
var editor = (TestComboBox)source;
editor.SelectedItem = car;
When I try to install the default value, I lose the binding. If I commented this code, everything works fine.
this.SelectedItem = this.Cars[0];
How can I set the default value without losing binding to the VM
P.S
TestAppI use this code.
<propgrid:PropertyGrid Margin="0,0,11,7">
<propgrid:PropertyGrid.Items>
<propgrid:PropertyGridCategoryItem DisplayName="Main">
<propgrid:PropertyGridPropertyItem Value="{Binding Car, Mode=TwoWay}"
DisplayName="Car">
<propgrid:PropertyGridPropertyItem.ValueTemplate>
<DataTemplate>
<wpfApplication1:TestComboBox SelectedCar="{Binding Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}" />
</DataTemplate>
</propgrid:PropertyGridPropertyItem.ValueTemplate>
</propgrid:PropertyGridPropertyItem>
</propgrid:PropertyGridCategoryItem>
</propgrid:PropertyGrid.Items>
</propgrid:PropertyGrid>
I found a solution my problem Ijust replacedthe code
this.SelectedItem = this.Cars[0];
with this
this.Loaded += (sender, args) =>
if (this.SelectedItem == null)
this.SelectedItem = this.Cars[0];
And now everything works fine -
How do i split a line in a csv file and populate a combobox and a textbox with the parts
What I'm trying to do is split the line and fill a combobox and with the selecteditem and the textbox with the value of the combobox selecteditem which is the second part of the line split.
Thanks in advance for the help or suggestions.Then you should create a class to represent the items in the ComboBox:
Public Class MyItem
Public Property PartA As String
Public Property PartB As String
End Class
...and add instances of this class to the ComboBox:
Try
Dim mydocpath1 As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim mylines() As String = File.ReadAllLines(mydocpath1 + "\TextFile1.txt")
For Each line In mylines
Dim parts() As String = line.Split(","c)
Dim item As MyItem = New MyItem With {.PartA = parts(0), .PartB = parts(1)}
cmb1.Items.Add(item)
Next line
cmb1.SelectedItem = cmb1.Items(1) 'select second item
Catch ex As Exception
MsgBox(ex.Message)
End Try
Then you set the DisplayMemberPath of the ComboBox to the name of one property and bind the Text property of the TextBlock to the other one:
<ComboBox Name="cmb1" DisplayMemberPath="PartA" />
<TextBlock Text="{Binding ElementName=cmb1, Path=SelectedItem.PartB}" />
That should solve your issue.
Once again, please remember to mark helpful posts as answer to close your threads and remember that a new thread deserves a new question. -
Commandlink and checkbox in a region(.jsff).
Hi all,
I have a commandlink and checkbox in a region(.jsff).
when i tried to call a method using propertychangeListener or Actionlistener ..
methosd is not calling ...
Plase give any solution...Hi,
not enough information - sorry
Frank -
Hi all,
I read the documentation about JTables but couldn't figure out how to solve my problem. I want to render combobox and button in the same JTable cell like in Netbeans. How can I do this? Any suggestions?Anyone with ideas?
-
Hey All,
I have found a lot of posts on here about adding values to a combo box using the valid values collection. I am trying to assign a datatable to the Combobox in my case. I add my datatable in the xml and assign a query to it. Then I assign that to the databind property of the combobox and when the form loads it only displays the 1st record in the query.
Any ideas what I am doing wrong?
I basically just want to display the list of item groups in my combo box without manually adding these to the valid values collection.
CurtisHi Curtis.
If it can help you this is some methods used in my programs:
1) ValidValues in xml file
<item uid="cType" type="113" left="100" tab_order="0"
width="150" top="10" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="1"
right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0"
AffectsFormMode="1">
<AutoManagedAttribute />
<specific AffectsFormMode="1" TabOrder="0">
<ValidValues>
<action type="add">
<ValidValue value="A" description="AAA" />
<ValidValue value="E" description="EEE" />
<ValidValue value="B" description="BB" />
<ValidValue value="D" description="DD" />
</action>
</ValidValues>
<databind databound="1" table="@TABLE_A" alias="U_TYPE" />
</specific>
</item>
2) Add ValidValues to combobox.
Private Sub CreateForm()
Dim oForm As SAPbouiCOM.Form
Dim oComboBox As SAPbouiCOM.ComboBox
Set oForm = SBO_Application.Forms.Add("MYFORM")
oForm.DataSources.UserDataSources.Add "DS", dt_SHORT_TEXT, 20
Set oComboBox = oForm.Items.Add("cCombo1", it_COMBO_BOX).Specific
oComboBox.DataBind.SetBound True, "", "DS"
oComboBox.ValidValues.Add "A", "Value A"
oComboBox.ValidValues.Add "B", "Value B"
oComboBox.ValidValues.Add "C", "Value C"
End Sub
3) Add Linked Table for field.
See this thread [User defined Valid values in SBO|User defined Valid values in SBO;
4) Recordset
See this thread [Fill values in combobox from database table|Fill values in combobox from database table;
5) LoadSeries Method (look SDK Help)
Other ways I don't know.
Best regards
Sierdna S. -
I need to have an ItemRenderer in the Grids that will combine a combobox with checkboxes. Any idea/sample?
ThanksFinally i used a double change:
<mx:Component>
<mx:CheckBox selectedField="selected" change="data.selected = selected; outerDocument.filtromeses()" />
</mx:Component>
Because this checkbox its inside a Component tag, if i want to access the filtromeses() function thats outside, need to add the OuterDocument.
Not sure if its the best way but it works.
Thanks -
Guys,
Ive a problem with a ALV and checkboxs. i have one with column type checkbox, i need mark rows and take them afterward using a button (in ALV) but rows arent marked when i use button. i have seen that it only happend when i use double click in grid (alv).
How could i use only button after marked my rows ?????
Thankswa_fieldcat-edit = 'X'.
modify i_fieldcat from wa_fieldcat index sy-tabix.
* Form f_alv_edit_oruser *
* Form for display alv *
form f_alv_edit_oruser.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = i_fieldcat[]
is_layout = pt_grplayout2
i_callback_program = 'YSCCU0007'
i_callback_html_top_of_page = p_header
i_callback_user_command = v_user_command1
it_events = i_events[]
tables
t_outtab = i_yscchdr.
endform. " F_alv_edit_oruser
* Form f_user_command1 *
* This form will handle the user command from fm REUSE *
form f_user_command1 using p_ucomm type sy-ucomm
rs_selfield type slis_selfield.
data p_ref1 type ref to cl_gui_alv_grid. "<<<
call function 'GET_GLOBALS_FROM_SLVC_FULLSCR' "<<<
importing "<<<
e_grid = p_ref1. "<<
call method p_ref1->check_changed_data. " <<<<
case p_ucomm.
when '&DATA_SAVE'.
endcase.
rs_selfield-refresh = c_x. " Grid refresh
endform. " F_user_command1 -
[svn:fx-trunk] 11737: ComboBox and DropDownList bug fixes
Revision: 11737
Author: [email protected]
Date: 2009-11-12 13:25:33 -0800 (Thu, 12 Nov 2009)
Log Message:
ComboBox and DropDownList bug fixes
SDK-23635 - Implement type-ahead in DropDownList
Added code in DropDownListBase keyDownHandler to listen for letters and change the selection if there is a match. At some point, we should modify findKey and findString (I'll file an ECR for that). For now, I've just overridden findKey and cobbled together the logic from List.findKey and List.findString. In ComboBox, we override findKey to do nothing since ComboBox has its own logic that relies on textInput changes.
SDK-23859 - DropDownList does not reset caretIndex when selection is cleared
Fixed this in two places. In ComboBox.keyDownHandlerHelper, we update the caret index when ESC is pressed. In DropDownListBase.dropDownController_closeHandler, we update the caret index if the commit has been canceled (ie. ESC was pressed).
SDK-24175 - ComboBox does not select an item with ENTER when openOnInput = false
When the ComboBox was closed and the arrow keys were pressed, the selectedIndex was changed. When ENTER was pressed, it was committing actualProposedSelectedIndex, not selectedIndex. The fix is to override the selectedIndex setter to keep actualProposedSelectedIndex in sync if selectedIndex was changed. Usually it is kept in sync when the dropDown is opened.
SDK-24174 - ComboBox does not scroll correctly when openOnInput = false
When typing in a match, the caretIndex was changed, but not the selectedIndex (because matching when it is closed doesn't commit the value until you press ENTER or lose focus). When closed, the navigation keys were changing the selectedIndex relative to the previous selectedIndex. I updated this to change relative to caretIndex instead. In most cases, caretIndex and selectedIndex are equivalent while the dropDown is closed.
Other changes:
- Replaced some calls to dropDownController.isOpen with isDropDownOpen.
- Added protection RTE protection to ComboBox.changeHighlightedSelection
QE notes: None
Doc notes: None
Bugs: SDK-23635, SDK-23859, SDK-24175, SDK-24174
Reviewer: Deepa
Tests run: ComboBox, DropDownList
Is noteworthy for integration: No
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-23635
http://bugs.adobe.com/jira/browse/SDK-23859
http://bugs.adobe.com/jira/browse/SDK-24175
http://bugs.adobe.com/jira/browse/SDK-24174
http://bugs.adobe.com/jira/browse/SDK-23635
http://bugs.adobe.com/jira/browse/SDK-23859
http://bugs.adobe.com/jira/browse/SDK-24175
http://bugs.adobe.com/jira/browse/SDK-24174
Modified Paths:
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ComboBox.as
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownListBase.asThis bug figures out also when creating a custom spark ComboBox, then trying to programatically update the userProposedSelectedIndex property. The proposed selected index is selected, but does not apply the same skin as when mouse is on rollover or item is selected due to up and down keys.
The issue seems like updating the status of the item renderer to rollover or selected to get the same skin applied.
Please could you attach DropDow nList.as that you edited ?
Thank you so much. -
Ok... i wish i can show my form without letting everyone have axx to it.
But anyway, ive searched and i think i found part of the answer but i am still confused. http://forums.adobe.com/message/2033382#2033382
I have a form created completely. It has radio fields, text fields and checkboxes. I have two problems
One when ppl are typing in the text field area, it seems to lend in with the question, so if not paying attn, u wont know that they answered a question.
Currently i have the stuff set at Myriad Pro size 10.. Thats what i used to type comments and what not.
But when the end user flls out the form, i want it to at least be in bold or something.. Or maybe Times new roman Or something different from the question font itself.
Two.. in checkboxes, the default is X. Thats very light. I need that to be noticeable... So either make em a bod X or a way to increase the size of the tick without increasing the size of the box itself.. I just tried to use the STAR..And its bold enuf, but its small. It would be better if the star was a lil bigger.
Currently i think i have 150 checkboxes and about 50 text area and fields.
I thought about making the text thing rich format, but they cant do that for every field... id rather tdo that by default in the back end of the form itself.
I hope im not sounding confusinfi know the square and circle are a bit ugly - but there is no chance you'll miss them
alternatively try adjusting the size a bit under -size you can take a standard checkboxes size from 10 to 12 without increasing its area for example - select the checkbox-objects-field-size - change to 12 eg - adds a bit of weight
i use squares when i need visual weigh -
for the text - might be worth having a test at setting input field values with a baseline shift -- thats basically make text bigger or smaller than, you guessed it, baseline -- this from the livecycle scripting reference
TextField1.font.baselineShift = "+5pt"; should do it for example --
scripting reference follows --- good luck
""baselineShift
Specifies a positive measurement that shifts a font up from the baseline or a negative measurement that
shifts a font down from the baseline.
Syntax
Reference_Syntax.baselineShift = "0in | measurement"
Type Values
String ● fit (default)
The application scales the image proportionally to the maximum size of the container’s
content region.
● none
The application scales the image to the size of entire container’s content region. This may
result in different scale values being applied to the image's X and Y coordinates.
● actual
The image is rendered using the dimensions stored in the image content. The extent of the
container’s region does not affect the sizing of the image.
● width
The application scales the image proportionally to the width of the container’s content
region. The image might be taller or shorter than the content region.
● height
The application scales the image proportionally to the height of the container’s content
region. The image might be wider or narrower than the content region.
Model Object
Form Model image
Adobe LiveCycle Designer ES Scripting Properties
LiveCycle Designer ES Scripting Reference before 156
Values
Applies to
Version
XFA 2.1
Examples
JavaScript
TextField1.font.baselineShift = "-5pt";
FormCalc
TextField1.font.baselineShift = "-5pt" -
ComboBox and JList working to gether?
Hey
Is it possible to get ComboBox and JList to work together?
Eksampel.
In the ComboBox there are 3 options to pick. Football, Hockey and Baseball. When one of these are picked all the names of the players
from for example football is shown in a JList.
Is this possbile? If yes how? can you give example or link to toturial?do you know a tutorial on this?Did you read the API for either JComboBox or JList????????
Both contain links to the Swing tutorial.
And why is it so difficult to post a Swing related question in the Swing forum??????? -
I have to add a change event listener...
I did add one something like this....
Private function Change(event:Event):void{
inputtxt.txt+=event.currentTarget.selectedIndex;
vs.selectedChild=vsRef;
<mx:TextInput id="inputtxt"/>
<mx:Button id="searchBtn" label="Search" change="Change(event)"/>
***This does nothing for me though***
OR
[Bindable] public var Emp:String;
[Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];
This is my combobox array now I have a text box next it, so that the user can enter name, number or id...
What should be in my change function?, I have:
private function change():void{
if (cb.selectedIndex==0)
Emp=cb.selectedItem
else if (cbEmp.selectedIndex==1)
Emp=????
else
Emp=????
<mx:ComboBox id="cb" dataProvider="{ary}"/>
and how do I store what user has enter....
which one is the right approach and how will they work... I'm just a little confused....
Thanks...can you show me how to incorporate valueCommit with TextInput, combobox and search and I do have to search based on what the used enter...
So if I have
<mx:Script>
<![CDATA[
[Bindable] public var Emp:String;
[Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];
]]>
</mx:Script>
<mx:ComboBox id="cb" dataProvider="{ary}"/>
<mx:TextInput id="inputtxt"/>
<mx:Button id="searchBtn" label="Search"/>
<mx:ViewStack id="vs">
<src:Ref id="vsRef"/>
</mx:ViewStack>
Now what I want to do is when the user enter either Employee Name or Number or ID in the textInput box next to the combobox filter based on what is selected in combobox (name, number or id) I have to bring up the viewstack which shows the datagrid with data based on what the user has input...
Can anyone help me with how do I incoprporate valueCommit or cb.selectedItem....
I'll really appreciate that.
Thanks... -
Radio buttons and checkboxes using panels......
Please help..
I am using radiobuttons and checkboxes with prices on them.. and once an item is selected the total is output.. this works when I don't use panels.. the minute I use panels it does not register what I am using.. can anyone help..
is there something that I am leaving out.. the basics would be great. please help.
AsmeenAre you really sure this is an advanced language topic?
Maybe you are looking for
-
Error 206 when trying to download software
i just purchased creative cloud and keep getting error 206 when trying to download the software.
-
Hi, I have a hp pavillion g series laptop which will no longer connect to the Internet. I have tried doing a recovery but this seems to only work now and again (gets less successful the more I do it). When I click on the Internet symbol it tells me I
-
SLDCHECK fails for XI server - SLD on separate system
Dear All, I have SLD configured on my solution manager system. All systems including XI are updating data in SLD -> Technical Systems. My problem When I execute SXMB_IFR, SLD web page opens up fine. But in transaction log is see following: Calling fu
-
Hello BW Experts, SCOT > view Node > SMTP > INT is switched off. please help. how to switch it on. Thanks, BWer
-
I've set a factory job and now I can not remember my mail and I could not activate the phone ..alrjae help me re- activate the phone and this zip to communicate with me ****** <Email Edited by Host>