there is little help material on how to use the InputComboBox within the C1InputPanel control. Say i like to have a simple list of strings in the dropdownlist ("item1", "item2", "item3"), default is Item2. By using the generic ComboBox control from WinForm, i can simply use:
combobox1.items.clear
combobox1.items.add("items1")
combobox1.items.add("items2")
combobox1.items.add("items3")
combobox1.selectedindex=1
but using InputCombobox, how to achieve this?
I use the following to insert each item:
dim lb as new InputLabel
lb.text="items1"
combobox1.items.add(lb)
is this correct? after that, i see the list gets populated, but the .selectedindex doesn't seem to work, and item can not be selected...
Found the answer by reading the sample file from ComponentOne. under the 'DataBinding’ project for C1InputPanel.
The correct way is to use:
combobox1.items.add(new c1.win.inputpanel.inputoption("items1″)
….
The Items collections of InputComboBox for C1InputPanel supports only InputOption and InputGroupHeader objects. Hence, the correct code would be :
dim lb as new InputOption
lb.text="items1"
combobox1.items.add(lb)
Thanks,
Richa
Related
I've a textArea with grow limit "2" and alignment "center". I need to hightlight the "Quick Booking" text of the following textArea differently ie. in color, size etc. Since the textArea is aligned center, this hightlighted text may appear anywhere as per the device width. How can I do that?
TextArea ta = new TextArea("Need urgent fix for your car ? We will get to you asap Quick Booking");
ta.setUIID("small");
ta.setEditable(false);
ta.setGrowByContent(true);
ta.setGrowLimit(2);
ta.getAllStyles().setAlignment(Label.CENTER);
How It is now...
How it should be...
That isn't supported. One option is to use a BrowserComponent for this element and format it with HTML. Another is to use a rich text view such as this: https://www.codenameone.com/blog/tip-lightweight-rich-text-view.html
I saw the stack question where it was solved. I didn't find it now otherwise I'd have shared the link. It works though.
homeContainer.add(FlowLayout.encloseCenter(lbl1, new Label("urgent"), new Label("fix"), new Label(" for"), new Label("your"), new Label("car? "), new Label("We"), new Label("will"), new Label("get"), new Label("to"), new Label("you"), new Label("asap "), clickable));
I am afraid this is not supported.I would suggest you to give a look on below article
https://medium.com/#Cuong.Le/android-rich-text-overview-397e6af529d9
Is it possible to use searchProperties.Add("Instance","1"); to assign instance id where the wpf application has multiple controls like buttons or combo boxes which are recognized as one instance of the control. If yes then how to do this? Any code sample is appreciated.
An addendum to AdrianHHH's excellent suggestion is to iterate through the FindMatchingControls collection and figure out which one is the one you want. If it's always collection[3] then you can identify it and act on it as such.
Your code would look like this:
var button = new WinButton(winWindowChild(mainParentCtName, childParentCtName));
//if you pass parents when you construct an object it can speed up find
button.SearchProperties.Add(/*any identifying properties*/);
var allButtons = button.FindMatchingControls();
//test code
foreach (var btn in allButtons)
Mouse.Click(btn); //watch this to figure out what order the buttons are iterating through, then remove loop
Mouse.Click(allButtons[3]);
Mouse.DoubleClick(allButtons[0]);
Mouse.Hover(allButtons[1]);
I am working on a flash project that dynamically generates navigation from an XML. For now I am trying to get it to work with arrays so that I can adapt it to xml once I know the logic works. I am new to as3 and learning has been a tiny bit bumpy. I have been searching for a solution to this but many of the examples I have seen have either been too simple to answer my question or too complex to understand since I am on the new side. This is the code I am working with.
var clientList:Array = new Array("Client1","Client2","Client3","Client4","Client5","Client6","Client7","Client8","Client9","Client10","Client11","Client12","Client13","Client14","Client15");
for each (var cName in clientList){
var newClientBtn:btnClientNav = new btnClientNav();
newClientBtn.x = workX;
newClientBtn.y = workY;
workY += newClientBtn.height;
newClientBtn.mcClientName.text = cName;
lContent.mcWork.addChild(newClientBtn.name);
trace(newClientBtn);
}
I can't fingure out how to properly refernce the dynamically created clips. I have a dynamic text box in the button but can't figure out how to reference it properly to change it, then my next issue will be referencing the buttons to make rollover and click code. I know this probably something simple to fix but I have been looking at it for too long and my eyes are starting to cross.. Thank you in advance for any advice you can give.
Why not store the clips you are creating in an object you can access later?
If you want to reference a movie clip by name though, one way to do it is:
var referenceMC:MovieClip = MovieClip(containerMC.getChildByName(“targetMC”));
If it was a text field or a button you were after, I believe you would do the same but instead cast the result of getChildByName to your desired control.
I also believe you want to add the button itself as a child, not pass its name into your addChild call?
i am trying to convert Vb.net To C#.net. could any one please help me to find the Equivalent C# coding for Dim dataTable As DataTable = CType(sender, GridView).DataSource.
and also,any tip for soring datas in data gridview.
thanks
You mean like this?:
DataTable dataTable = ((GridView)sender).DataSource;
To cast types in C#, you put the type in parentheses before the value:
(GridView)sender
Then, to access properties on it, you'll want to wrap the whole thing in parentheses:
((GridView)sender).DataSource
(This is because otherwise you'd be trying to call .DataSource on the un-cast sender which would fail.)
Then to declare a value (the variable that you're assigning), the standard syntax is to specify the type and then the variable name:
DataTable dataTable
(I highly recommend using a better variable name, by the way. C# is case-sensitive, so this is valid. But it's unintuitive at best.)
In C# you can also use the var keyword to infer the type, often resulting in cleaner code:
var dataTable = new DataTable();
This only works if there's an inferrable type from the right side of the assignment. Since the DataSource property isn't specifically of type DataTable then you don't want to use var in this particular case, since it would result in an Object (which isn't what you're looking for). But it can be used in cases like my last example above this paragraph where you don't want to repeat the type name twice in the same line of code.
DataTable dataTable = ((GridView)sender).DataSource
Regarding sorting in a GridView, see Sorting Data in a GridView Web Server Control, then post a question with what you have tried if you're having problems.
This drives me crazy:
i'm using a datagridview (bound to a dataset) and textboxes also bound to the dataset (which means that everything typed into the textboxes is reflected in the datagridview). The datagridview is actually used only to show up the values (user is NOT able to edit anything in the cells).
So: when the user pushes the add new record button (automatically created by visual studio using binding navigator etc. ) i would like to programmatically select this new line (remember: user has not the ability to select with the mouse) and insert some values.
I tried to use the
DefaultValuesNeeded
event, but this is firing only if the user selects the row with the asterisk indicator (what the user is not allowed to do).
How can i simulate that behavior? Should i take another approach?
Thanks in advance!!
Was searching for alternatives to how I currently do this and just wanted to let you know about a couple ways I know of. Both of these will set defaults when using the * (new row) or using a BindingNavigator.
private void CityBindingSource_AddingNew(object sender,
AddingNewEventArgs e)
{
// Simply set the default value to the next viable ID,
// will automatically set the value when needed.
locationDataSet.CITY.CITY_IDColumn.DefaultValue =
CityTableAdapter.GetNewID(); // ++maxID;
}
Or
private void CityDataGridView_DefaultValuesNeeded(object sender,
DataGridViewRowEventArgs e)
{
// Gets called when datagridview's */NewRow is entered.
e.Row.Cells[0].Value = CityTableAdapter.GetNewID(); // ++maxID;
}
private void bindingNavigatorAddNewItem_Click(object sender,
EventArgs e)
{
// BindingNavigator button's AddNewItem automatic tie-
// in to bindingSource's AddNew() is removed.
// This sets the current cell to the NewRow's cell to trigger
// DefaultValuesNeeded event.
CityDataGridView.CurrentCell =
CityDataGridView.Rows[CityDataGridView.NewRowIndex].Cells[1];
}
I was really hoping to use this:
private void CityBindingSource_AddingNew(object sender,
AddingNewEventArgs e)
{
// Cast your strongly-typed
// bindingsource List to a DataView and add a new DataRowView
DataRowView rowView =
((DataView)CityBindingSource.List).AddNew();
var newRow = (LocationDTSDataSet.CITYRow)rowView.Row;
newRow.CITY_ID = CityTableAdapter.GetNewID();
newRow.CMMT_TXT = "Whatever defaults I want";
e.NewObject = rowView;
}
But when adding using the BindingNavigator or any code based bindingSource.AddNew() it results in just a blank row. Hopefully someone finds a better way, but this is working for me so far.
Revised:
How about the Datatable's TableNewRow event, then? If that gets fired when the BindingNavigator creates a new row, then that's an opportunity to populate the object.