I have a file in which some text is stored. Now I want to display the text in a list box using gtk. How can I do this?
Also the values are changing dynamically. Is there a way to refresh the listbox?
This is done using model-view architecture in GTK. The view is a GtkTreeView, and you can associate it with a GtkListStore, which you can update dynamically. The tree view will refresh automatically when you update the list store.
You might also want to read this overview of tree and list widgets in GTK.
Related
Given there is a Grid using a cell editing plugin is there a way to reference a combobox editor without doing it in a global way ?
I have this working:
this.grid().rowAt(0).cellAt(0).click(); // click to show the combo
ST.comboBox('combobox[itemId=someID]').expand().setValue(1); // this works but looks for the combo globally
BUT I think I should be able to do:
this.grid().gotoComboBox('combobox[itemId=someID]'); // this doesn't work
or something like:
this.window().gotoComboBox('combobox[itemId=someID]'); // this doesn't work either (grid is within a window)
All of the goto() methods ultimately use Ext.ComponentQuery/down() to traverse the component hierarchy to resolve the future's component. If you were to try this yourself apart from the ST API, you'd find that you can't get the instance of the combobox by doing down() on the grid or its parent (e.g, grid.down('combobox[itemId=someId]').
I think a nice feature would be to have some apis in the row/cell futures that would enable specific actions on editors. It's an area we see a lot of questions in, so that would probably be a more robust solution. I'll add a feature request for it.
Basically I use lists to display information, these lists contain custom data items I have created, they all look similar and have some of the same controls in them, essentially they need to look the same colour, font etc. At the moment, I just seem to be repeating code over and over each time a change is needed i.e. colour.
I have been wondering if it would be a good idea to create a generic data item which all the lists use and then just collapse controls which aren't needed.
So I was going to create a user control called something like "GenericDataItem". This data item will contain all the controls that each data item would need, then use dependency properties to collapse controls not required.
My question is would this be the right way to go about this, or is there a better way?
Thanks.
Not sure I got the point, but using DataTemplateSelector could help you.
I understand and have read about using WPF's FlowDocument to create an XML style document on screen, but is the content presented editable by the user, or is it read only? And, if so, how is this done?
My question mostly centres around the use of the listitem control because it would be nice to be able to edit the order of the list items presented for use in my program, rather than me having to create my own custom control(s).
Regards.
FlowDocuments as objects are editable, if they can be edited in the UI depends on the controls that use them. If you use them in a Page they are not, if you use them in a RichTextBox they are.
I was wondering that currently we have gtk.TextViewWidget to display the contents of widget. I was wondering is there any way to make a type of My Computer Properties dialog box where there are different panels at top and one can click on any one of them to display the contents of that property.
Can anyone give me some good advice on how to proceed making this?
Sounds like you need a GtkNotebook.
I'm not sure I understand fully what you mean, but it sounds as if you could easily just stack a GtkTreeView on top of a GtkTextView to achieve what you want. Populate the tree view with a suitable model holding the items in your computer (how to find this information is of course a separate problem), and then as a tree item is clicked, modify the text view's buffer to display the associated information.
I want to create a table representing data I have, but I want each row to have a custom display. I have developed a little custom control that represents a row and has a few items in it (text box, check box, progress bar), however how do I now in the main form create multiple instances of this for the data I have?
e.g. is there a winforms control I can use to do this? or do I have to take a panel or something and programmatically do it?
I do need to somehow take responses back. So if someone clicks on the button in the 4th row say then I'll need to be able to tell which row it was from.
As an aside would then be a way to BIND the above mentioned visualization of my data to the data itself, say housed in an Array?
thanks
I see two options here:
You can use a DataRepeater. This control can be found in the Microsoft Visual Basic Powerpack. It allows you to place controls on a template which gets copied for each item in the databound collection.
You can create a custom control and manually place one instance of it for each item in a collection, re-creating databinding for the controls in it. This requires you to either expose the controls inside publicly or as properties of the user control.
However, above options are mostly useful for non-tabular data. If your layout is strictly tabular (i. e. rectangular cells in a grid) then you can create a custom DataGridViewCell which takes some time to understand but not too much code. Putting a progress bar into such a cell shouldn't prove too difficult.