How to hide Y-axis values in invientcharts - charts

Is there a way to hide a InvientChart NumberYAxis? The yaxis is meaningless on logic analyzer display.

Don't know about hiding simply with a method, but this should work.
InvientChartsConfig.YAxisDataLabel label = new InvientChartsConfig.YAxisDataLabel(true);
label.setFormatterJsFunc("function() { return ''; }");
yaxis.setLabel(label);
It should replace the numeric values with empty space.

#miq, sorry for late reply, I don't know whether that works. But after serious struggling, I did this..
YAxisDataLabel yLabel=new YAxisDataLabel();
yLabel.setEnabled(false);
yAxis.setLabel(yLabel);
And its working like charm...anyways thanks for your answer. I will consider that and will try it int future..

Related

Gtk (mm) limit width of combobox

Because I use Comboboxes that may contain text entries of very long size,
which leads to the combobox increasing its width far beyond reasonable size,
I am trying to give a maximum width to the combobox.
If I am doing this like this:
class MyCombo : public Gtk::ComboBox {
private:
CellRendererText render;
public:
MyCombo() {
render.property_width_chars() = 10;
render.property_ellipsize() = Pango::ELLIPSIZE_END;
pack_start(render, true);
}
};
The result will be an empty cell of the desired width, which seems logical since I did not specify which column to show. But how can I do this with that attempt? Using pack_start will just bypass the renderer...
Another approach is this one:
class MyCombo : public Gtk::ComboBox {
private:
CellRendererText render;
public:
MyCombo() {
pack_start(render, true);
set_cell_data_func(render, sigc::mem_fun(*this, &MyCombo::render_iter));
}
void render_iter(const TreeModel::const_iterator& iter) {
Glib::ustring data = get_string_from_iter(iter);
int desired_width_chars = 10; //for example
render.property_text() = ellipsize_string(data, desired_width_chars);
}
};
Using that approach, it works, but the text in the popup (what opens up when u click the combobox) is also shortened which is not what I want (obviously the user should be able to read the whole string and I dont care about the popup widht.)
Can you please help me with this? I would be happy for any advice/alternative solutions.
Regards tagelicht
NOTE: set_wrap_width is a function that wraps the total number of entries in the combo box over a number of columns specified; it does not answer the question.
Using set_wrap_width(1) | Using set_wrap_width(5)
Following Noup's answer as a guide I managed to get the below code; which directly answers the question and its requirements (C++/Gtkmm).
// Get the first cell renderer of the ComboBox.
auto v_cellRenderer = (Gtk::CellRendererText*)v_comboBox.get_first_cell();
// Probably obsolete; Sets character width to 1.
v_cellRenderer->property_width_chars() = 1;
// Sets the ellipses ("...") to be at the end, where text overflows.
// See Pango::ELLIPSIZE enum for other values.
v_cellRenderer->property_ellipsize() = Pango::ELLIPSIZE_END;
// Sets the size of the box, change this to suit your needs.
// -1 sets it to automatic scaling: (width, height).
v_cellRenderer->set_fixed_size(200, -1);
Result (image):
Result of code
BE AWARE: Depending on where you perform the above code; either all the cells will be the same size, or just the box itself (intended).
From experimenting, I've found:
In the parent object constructor: All cell sizes are the same.
In a separate function: Only the first cell (the box) is affected.
I'd recommend you put the code in a function that's connected to the comboBox's changed signal, such as:
v_comboBox.signal_changed().connect(sigc::mem_fun(*this, &YourClass::comboBox_changedFunction));
This may be what you are looking for:
cell_renderer_text.set_wrap_width(10)
This is for Python, but you get the idea :-)
Unfortunately, the documentation is scarce. I found this by poking around in Anjuta/Glade.
Edit:
the docs are here. They are not overly helpful, but they do exist.
As an alternative, the following works for me without having to set wrap_width nor to subclass ComboBox (in Gtk#):
ComboBoxText cb = new ComboBoxText();
cb.Hexpand = true; //If there's available space, we use it
CellRendererText renderer = (cb.Cells[0] as CellRendererText); //Get the ComboBoxText only renderer
renderer.WidthChars = 20; //Always show at least 20 chars
renderer.Ellipsize = Pango.EllipsizeMode.End;
Note: I'm using Expand to use space if it's available. If you just want to keep the combo box on a fixed width, just remove that bit.

GXT 3 - Sorting causes grid to horizontally scroll

If I try to sort a column that's out of view (I need to scroll on the right to see it)
then the column sorts but the table scrolls back to the left, (and the column i sorted is out of view again)
One can try this in the Basic Gid of the GXT showcase:
Just make the width of the columns larger so that the horizontal scroller shows up and then try to scroll at the end of the table and sort.
How to fix this?
Thanks
This is how I solved it:
Override onDataChanged of GridView and set preventScrollToTopOnRefresh to true before sorting and then set it back to whatever it was. I wonder why this is not the default behaviour.
final GroupSummaryView<Row> view = new GroupSummaryView<Row>()
{
protected void onDataChanged(StoreDataChangeEvent<Row> se)
{
boolean b = preventScrollToTopOnRefresh;
preventScrollToTopOnRefresh = true;
super.onDataChanged(se);
preventScrollToTopOnRefresh = b;
}
};
_table.setView(view);
There is no built-in feature to prevent that behavior, so you have to write it yourself. You just need to store the scroll state before sorting and restore it after:
// save scroll state
final int scrollTop = getView().getScroller().getScrollTop();
final int scrollLeft = getView().getScroller().getScrollLeft();
// restore scroll state
getView().getScroller().setScrollTop(scrollTop);
getView().getScroller().setScrollLeft(scrollLeft);
#Darek Kay : Thank You very much. I was having an issue of scroll down while changing the option by selecting value from EditorTreeGrid. Your suggesion worked for me. Here's what I did and worked for me :
final int scrollTop = editorTreeGrid.getView().getScroller().getScrollTop();
final int scrollLeft = ditorTreeGrid.getView().getScroller().getScrollLeft();
editorTreeGrid.getView().refresh(true);
editorTreeGrid.getView().getScroller().setScrollTop(scrollTop);
editorTreeGrid.getView().getScroller().setScrollLeft(scrollLeft);

Get the number value of a texfield Xcode

I want to have a textfield where the user can input a number and then set a label to that value. Is there any "texfield.value" or something that can fetch the value in numbers?
This is the only piece i heve done. should i put it here?:
- (IBAction)set:(id)sender;
{
}
Thanks in advance
In Xcode, select the textField or textView and change the keyboard type to Numeric.
Then you can get the value of whatever the user inputs into that field by doing:
int value = [[textField.text] intValue];
You can grab the integer value of a textfield using the following snippet.
[textField.text intValue]
Hope this helps.
You can get by textfield.text this will return the text value of that text field , now to convert it to number
NSNumber * mynumber = [NSNumber numberWithInt:[[textfield. text] intValue]];
nslog(#"%#",mynumber);
Here's an example of something I just used:
[self.phoneNumberTextField.text intValue];
You have to be careful with this one. Here are the steps to get this to work
In storyboard, select the textfield
Open the attributes tab for the textfield in Interface Builder
Change keyboard type to "Number Pad" (This guarantees that the user will only be able to enter ints into the textfield)
Now, in your code, type [self.myTextField.text intValue]; (set this equal to a local variable)
Now, as far as WHERE in the code you'll put this, it depends. If you're trying to log in a user, I'd recommend putting this in an IBAction like 'loginButtonPressed'. Or before you transition to a new screen in 'viewWillDisappear' or even 'prepareForSegue'.
Good luck!
This is from 3 years ago, I tried using that and didn't work and so I find this working for me
int i = textfield.text.intValue;

How can I insert an image on a Gtk.Label. Is this possible? Or do I need to find another solution?

I have a Database with this fields: Firstname, Lastname, picture.
I have a gtk.Label named infoLabel.
I would like to update the label a way like this:
Label.set_markup("<img src='pix/1.png'>\nName" + Firstname + " " + Lastname)
But it isn't works, because img isn't allowed in Pango markup. How I can do this?
Here is an example of a "Home" label.
label_with_icon = gtk.HBox()
icon = gtk.image_new_from_stock(gtk.STOCK_HOME, gtk.ICON_SIZE_MENU)
label_with_icon.pack_start(icon)
label_with_icon.pack_start(gtk.Label('Home'))
label_with_icon.show_all()
I wouldn't expect to be able to have an image in label, no.
But you should be able to replace any label with a container holding a GtkImage and the label, and solve it that way.
Of course you will have to have the image in local memory, first.
This is based on John La Rooy's answer, but I had to make some adjustments. Don't know why, maybe due to a different version of the library or something.
label_with_icon = gtk.HBox()
icon = Gtk.Image.new_from_file("/path/to/file.png") # not .image_new_from_file
label_with_icon.pack_start(icon, False, False, 0) # this method takes five args
label_with_icon.pack_start(gtk.Label('a caption'))
label_with_icon.show_all()

Select text on click in EditorGridPanel (gwt-ext)

I have a gwt-ext EditorGridPanel, by clicking onto a cell, you can edit its value. The cursor is placed at the beginnig of the cell, but I want to select the whole text in this cell if the user clicks on it. Any idea how I can handle this?
I tried some Listeners etc. but none worked for me yet.
Sorry for my english, with Ext-GWT(GXT) it's posible doing this:
final TextField<String> text = new TextField<String>();
text.setAllowBlank(false);
CellEditor textEditor = new CellEditor(text);
textEditor.addListener(Events.StartEdit, new Listener<EditorEvent>() {
public void handleEvent(EditorEvent be) {
text.setSelectOnFocus(true);
}
});
column.setEditor(textEditor);
configs.add(column);
Just find the way in GWT-Ext, I think will something like this.....I hope this help....