I have a Gtk.Grid to which I want to add a row with a combo box, which is initialized with a list. However, my combo box is empty. Can anyone see what I'm missing here?
I used this tutorial as reference
queryTypes = ["Name", "Grade", "Year", "Faculty"]
queryStore = Gtk.ListStore(str)
for qt in queryTypes:
queryStore.append([qt])
window = builder.get_object("mainWindow")
grid = builder.get_object("queryGrid")
grid.nRows = 1
combox = Gtk.ComboBox.new_with_model(queryStore)
grid.add(combox)
window.show_all()
Gtk.main()
Your combobox is missing a renderer.
queryTypes = ["Name", "Grade", "Year", "Faculty"]
queryStore = Gtk.ListStore(str)
for qt in queryTypes:
queryStore.append([qt])
window = builder.get_object("mainWindow")
grid = builder.get_object("queryGrid")
grid.nRows = 1
combox = Gtk.ComboBox.new_with_model(queryStore)
renderer_text = Gtk.CellRendererText()
combox.pack_start(renderer_text, True)
combox.add_attribute(renderer_text, "text", 0)
grid.add(combox)
window.show_all()
Gtk.main()
Related
I would like to change the text of my TextAnnotation in a chart. However, I can't find the .Text property in chart.Annotations("annoRent") .I know it is because I haven't specified it is a TextAnnotation. How do I do that?
You can cast it as TextAnnotaion then use Text property as usual:
((TextAnnotation)chart.Annotations("annoRent")).Text = "your text";
' Create a callout annotation
Dim annotationCallout As New CalloutAnnotation()
' Setup visual attributes
annotationCallout.AnchorDataPoint = Chart11.Series(0).Points(critvalpoint) ' this is the data point in the series
annotationCallout.AnchorX = 'this is an x-value in chart
annotationCallout.AnchorY = 'this is a y-value in chart
annotationCallout.Text = "Hello World"
annotationCallout.BackColor = Color.FromArgb(255, 0, 0)
annotationCallout.ClipToChartArea = "Default"
' Prevent moving or selecting
annotationCallout.AllowMoving = False
annotationCallout.AllowAnchorMoving = False
annotationCallout.AllowSelecting = False
' Add the annotation to the collection
Chart1.Annotations.Add(annotationCallout)
' Create a rectangle annotation
Dim annotationRectangle As New RectangleAnnotation()
' Setup visual attributes
annotationRectangle.Text = "Attached to" + ControlChars.Lf + "Chart Picture"
annotationRectangle.BackColor = Color.FromArgb(255, 0, 0)
annotationRectangle.AnchorX = 30
annotationRectangle.AnchorY = 25
' Prevent moving or selecting
annotationRectangle.AllowMoving = False
annotationRectangle.AllowAnchorMoving = False
annotationRectangle.AllowSelecting = False
' Add the annotation to the collection
Chart1.Annotations.Add(annotationRectangle)
I'm creating a TextField as so:
iTextSharp.text.pdf.TextField fieldCombo = new iTextSharp.text.pdf.TextField(stamp.Writer, realArea, placeHolder);
fieldCombo.Choices = (new string[1] { "" }).Concat(attribute.Values.Select(x => x.Value.Code)).ToArray();
iTextSharp.text.Font bold = iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 9f, iTextSharp.text.Font.BOLD);
fieldCombo.Font = bold.BaseFont;
fieldCombo.FieldName = Guid.NewGuid().ToSafeString();
fieldCombo.FontSize = 10f;
fieldCombo.TextColor = new iTextSharp.text.BaseColor(System.Drawing.Color.FromArgb(255, 6, 97, 50));
fieldCombo.Options = iTextSharp.text.pdf.BaseField.EDIT | iTextSharp.text.pdf.BaseField.VISIBLE_BUT_DOES_NOT_PRINT;
stamp.AddAnnotation(fieldCombo.GetComboField(), page + 1);
From the first time the field is focussed, a very generic grayish down arrow appears on the document, positioned next to my value. Even if the field is unfocussed, this arrow stay visible.
Can I get rid of this combo box button when printing the document?
I have a probably rather basic problem in OpenLayers, it would be really great if someone could help me out on this one.
I have an array of markers, which should each have a different popup box text. However, I fail in applying the according text to a marker. I tried to do this via another array for the content of the popup boxes. However, i couldn't relate the correct text to a marker. Here is my code:
var vs_locations = [
[13.045240, 47.8013271],
[13.145240, 47.8013271],
[13.245240, 47.8013271],
];
var popupContentHTML = [
"Text for marker with loc[0]",
"Text for marker with loc[1]",
"Text for marker with loc[2]"
];
function addVS(){
for (var i = 0; i < vs_locations.length;i++){
var loc = vs_locations[i];
var feature = new OpenLayers.Feature(volksschulen, new OpenLayers.LonLat(loc[0],loc[1],loc[2]).transform(proj4326,proj900913));
feature.closeBox = true;
feature.data.icon = new OpenLayers.Icon('coffeehouse.png');
feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true,
});
marker = feature.createMarker();
volksschulen.addMarker(marker);
feature.data.popupContentHTML = ; //Here should be the text according to the marker
feature.data.overflow = "auto";
marker.events.register("mousedown", feature, markerClick);
feature.popup = feature.createPopup(feature.closeBox);
map.addPopup(feature.popup);
feature.popup.hide();
}
}
did you try:
feature.data.popupContentHTML = popupContentHTML[i];
assuming the length of your location array matches your text array, both in length anf position
I have a grid that is dynamically generated based on search criteria. I render the grid in a partial view using Ajax. That all works fine.
I now need to add a checkbox column as the first column.
Also, how do I get filtering, sorting paging etc. to work now since it is in a partial view.
When i click on a header to sort I get a Page not found error and the filter Icon doesnt do anything.
And one more thing. When I try to add a GridCommandColumnSettings to the grid I get the error
"Invalid initializer member declarator"
Code is below for the gridcolumnsettings
public GridColumnSettings[] NewColumns(DataTable fullDT)
{
GridColumnSettings[] newColumns = new GridColumnSettings[fullDT.Columns.Count];
for (int i = 0; i < fullDT.Columns.Count; i++)
{
// set the visibility property for the DeliveryID
bool boolDeliveryID;
if (fullDT.Columns[i].ColumnName == "DeliveryID")
boolDeliveryID = false;
else
boolDeliveryID = true;
newColumns[i] = new GridColumnSettings
{
new GridCommandColumnSettings
{
Commands =
{
new GridEditActionCommand(),
new GridDeleteActionCommand()
},
Width = "200px",
Title = "Commands"
},
Member = fullDT.Columns[i].ColumnName,
Title = fullDT.Columns[i].ColumnName,
Visible = boolDeliveryID,
Filterable = true,
Sortable = true
};
}
return newColumns;
}
Any suggestions would be appreciated.
Thanks
I edited my post to add my partial for the Grid
Here is my partial for the grid
#(Html.Telerik().Grid<System.Data.DataRow>(Model.Data.Rows.Cast<System.Data.DataRow>())
.Name("Grid")
.Columns(columns =>
{
columns.LoadSettings(Model.Columns as IEnumerable<GridColumnSettings>);
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("_DeliveryManagerCustomBinding", "Deliveries"))
.EnableCustomBinding(true)
.Resizable(resize => resize.Columns(true))
)
I don't add columns this way when I use the Telerik Grid control, but looking at what you're doing I would hazard a guess to say you will need to do something like the following:
increase the size of the newColumns array by 1 (because we're going to add in the checkbox column):
GridColumnSettings[] newColumns = new GridColumnSettings[fullDT.Columns.Count + 1];
if you want it at the beginning you will need to do the following before your for-loop:
GridColumnSettings s = new GridColumnSettings() {
ClientTemplate("<input type=\"checkbox\" name=\"checkeditems\" value=\"some value\" />")
Title("title goes in here")
};
Then you will add it into your array:
newColumns[0] = s;
and then increase the start index for your for-loop to 1:
for (int i = 1; i < fullDT.Columns.Count; i++)
the checkbox column will go at the beginning
I am trying to set a colour to highlight a button. However, the modify_fg method only seems to set the focus ring's colour. modify_bg works as expected.
This is my code:
use Gtk2 qw/-init/;
my $window = Gtk2::Window->new;
$window->set_title("Window!");
my $button = Gtk2::Button->new("Coloured _button");
# does not affect text
$button->modify_fg(normal => Gtk2::Gdk::Color->new(0xffff, 0, 0));
$window->add($button);
$window->show_all;
Gtk2->main;
I'm also interested whether there is a standard colour for this sort of highlight, to blend in with the user's theme.
you can get the button's child label and modify its foreground, below is an example (python, let me know if there are troubles converting it to perl)
import gtk
class TestWindow:
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
box = gtk.VBox()
button0 = gtk.Button("Test Button")
label0 = button0.get_children()[0]
label0.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('red'))
button1 = gtk.Button(stock=gtk.STOCK_ABOUT)
alignment = button1.get_children()[0]
hbox = alignment.get_children()[0]
image, label1 = hbox.get_children()
label1.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('blue'))
box.add(button0)
box.add(button1)
window.add(box)
window.set_size_request(200, 200)
window.show_all()
def close_application(self, widget, event, data=None):
gtk.main_quit()
return False
if __name__ == "__main__":
TestWindow()
gtk.main()
hope this helps, regards
All previous helped a lot...
All the following works ok!
my $beige = Gtk2::Gdk::Color->new (0xFFFF,0xFFFF,0xCCCC);
my $azul = Gtk2::Gdk::Color->new (0,0,0xCCCC);
my $rojo = Gtk2::Gdk::Color->new (0xCCCC,0,0);
$mw->modify_bg ("normal", $beige);
my $butOk = Gtk2::Button->new_with_label(" 🗹 ¡Ya Terminé!");
($butOk->get_children)[0]->modify_fg("normal", $azul);
($butOk->get_children)[0]->modify_font(Pango::FontDescription->from_string ("Serif Bold 27"));
my $imgBTN = Gtk2::Button->new();
my $img = Gtk2::Image->new_from_file("$imagen");
$imgBTN->set_property("image"=>$img);