I have added a ttk::treeview in my TCL/Tk application.During the first initialization I set a treenode's value to "Inactive".
set parent [$nb.props.tree insert {} 2 -id traffic -text "Traffic" -open true]
$nb.props.tree insert $parent end -text "Status" -values "Inactive"
$nb.props.tree insert $parent end -text "Location" -values $Path
There are also a lot of other nodes. But later only the value of 'Status' may change. Now the problem is I don't want to delete and repopulate the whole tree because that that is causing flickering.I just want to change the value of the Status node. But I am not sure how to select the node and only change its value later . please help.
The manual page (http://www.tcl.tk/man/tcl8.6/TkCmd/ttk_treeview.htm) says:
pathname insert returns the item identifier of the newly created item. [...]
And:
pathname item item ?-option ?value -option value...?
Query or modify the options for the specified item. [...]
Related
I am working on Forms 6i on a very old software.
There is a requirement to add 3 List Item (Combo Box) to the form.
If the value in List Item X is changed, then upon WHEN_VALIDATE_ITEM, I need to change the value on List Item Y.
Here is the code but it's not working.
BEGIN
IF :PIH.TEXT_ITEM1544='Book' THEN
Copy('Own Use',Name_In('PIH.TEXT_ITEM1546'));
END IF;
END;
There are no errors in compilation, but I believe that when I select the value Book and press enter or tab and go to another field, nothing is triggered.
Any help would be really appreciable.
What do you want to do exactly? If you want to assign the value 'Own Use' to the item PIH.TEXT_ITEM1546 you can do it with:
:PIH.TEXT_ITEM1546 := 'Own Use';
Or with:
Copy('Own Use','PIH.TEXT_ITEM1546')
The statement you're using:
Copy('Own Use',Name_In('PIH.TEXT_ITEM1546'));
is trying to copy the value 'Own Use' to the item referenced by PIH.TEXT_ITEM1546, i.e., it's trying to copy the value to an item named as the value stored in the item PIH.TEXT_ITEM1546.
The Name_In function gets the value of the specified item.
I am using an Entry with an EntryCompletion opbject that has a ListStore model.
For each record in the model, there is an image I would like to display in the autocomplete-popup list.
How can this be done?
Is it possible to add a Gtk.CellRendererPixbuf column to the model?
Interesting enough I could not find any examples of this yet it turns out to be possible and not insanely complicated. Lets start with a small image of the goal which uses icons for convinces reasons.
So how do we get there, first we create the ListStore containing a column with strings to match on and a icon-name to convert into a pixbuf (this could also be a pixbuf directly).
# Define the entries for the auto complete
entries = [
('revert', 'document-revert'),
('delete', 'edit-delete'),
('dev help', 'devhelp'),
]
# Setup the list store (Note that the data types should match those of the entries)
list_store = Gtk.ListStore(str, str)
# Fill the list store
for entry_pair in entries:
list_store.append(entry_pair)
Next step is setting up the EntryCompletion and linking it with the Liststore
# Create the Entry Completion and link it to the list store
completion = Gtk.EntryCompletion()
completion.set_model(list_store)
Now the magic, we need to create 2 renderers, one for the text, one for the pixbufs. We then pack these in the completion to add columns to it.
# Create renderer's for the pixbufs and text
image_renderer = Gtk.CellRendererPixbuf.new()
cell_renderer = Gtk.CellRendererText.new()
# Pack the columns in to the completion, in this case first the image then the string
completion.pack_start(image_renderer, True)
completion.pack_start(cell_renderer, True)
In order to make sure the renderers use the the correct column we here specify which column from the ListStore the renderers should read. For the image_renderer we set the icon_name attribute as we give it icon names. If we would feed it Pixbuf's we would need the pixbuf instead.
# Set up the renderer's such that the read the correct column
completion.add_attribute(image_renderer, "icon_name", 1)
completion.add_attribute(cell_renderer, "text", 0)
As there are no multiple column we need to tell the completion which column contains the string. In our case column 0.
# Tell the completion which column contains the strings to base the completion on
completion.props.text_column = 0
# Create the entry and link it to the completion
entry = Gtk.Entry()
entry.set_completion(completion)
And that's it!
I am using Pentaho report designer 5.0 CE.
My report is having two groups, and one group contains row band with elements and values like,
Group1
Group2
Label1 - Value1
Label2 - Value2
Label3 - Value3
...
I need to show a row only if the value is not empty(without leaving blank space).
I set the 'invisible-consumes-space' property to false (band level). The blank space is still there.
how could i hide a label & value (entire row) if the value is empty?
have you tried to put the label element and value element in a band. assumingly value is printed by name field.
this is your band.
-----------------
|label | name |
-----------------
select the band from structure tree and go to style tab->size&position -> visible option.
then open the expression tab and paste
=IF(ISBLANK([Name]);"False"; "True")
OR
=IF(LEN([Name])<=0;"False"; "True")
I use the one below to hide all the group headers & footers when there is no data.
set no data band -> hide-on-canvas option to false. Add a message
field and let's say 'No data available for selected date range'
And set all Report Header & Footer's visible option to:
=IF(ISEMPTYDATA();"False"; "True")
And it works.
Hope helps to you too.
And empty string is not the same as an invisible element. Use the "visible" style instead and add your formula to the band's "visible" style setting to hide the band and all its subbands.
When a KendoDropDownList is created it's initial index is set to -1 and the text is empty.
IE: $("#txtQPLPickupFrom").data("kendoDropDownList").select() would return a -1.
When a selection is made, the select() returns the selected index (0,1,2,3...).
My question is, I want to return the selected index back to -1 when I am displaying an new record entry where the user has not selected a value. Trying to use .select(-1) does not seem to work. So it there a way to restore the initial selection to nothing (-1) after it's already had a value.
This should work:
$("#txtQPLPickupFrom").data("kendoDropDownList").value(-1);
Here is a fiddle (not mine): http://jsfiddle.net/EaNm4/124/
The kendo dropdown will always default to the first item in its datasource. You could configure the dropdown to use optionLabel: ' ' (a space), which will cause the initial value selected to have no text.
You could then reset the selection to this value with .select(0).
This seems to work: (I have to do more testing)
var txtQPLPickupFrom = $("#txtQPLPickupFrom").data("kendoDropDownList");
txtQPLPickupFrom.text(txtQPLPickupFrom.options.optionLabel);
txtQPLPickupFrom.element.val("");
txtQPLPickupFrom.selectedIndex = -1;
This worked for me:
$("#Actions").data("kendoDropDownList").refresh();
use txtQPLPickupFrom.value(-1)
txtQPLPickupFrom.value(-1);
this should set it to empty
I have several nodes (see below). I know how to select specific nodes which have a certain attribute. But in this case I would like to import the "file_url" value of the media objects that belong to the group "narrowImage".
<media_object>
<media_object>
<file_id>5175967</file_id>
<group>wideImage</group>
<file_url>http://www.mysite.com/image1.jpg</file_url>
</media_object>
<media_object>
<file_id>5175968</file_id>
<group>wideImage</group>
<file_url>http://www.mysite.com/image2.jpg</file_url>
</media_object>
<media_object>
<file_id>5175969</file_id>
<group>narrowImage</group>
<file_url>http://www.mysite.com/image3.jpg</file_url>
</media_object>
</media_object>
In the above case i would only need the value "http://www.mysite.com/image3.jpg"
any xpath expert out there who can point me in the right direction?
Use:
/*/*[group = 'narrowImage']/file_url
This selects any file_url element that is a "grand-child" of the top element in the XML document, and whose parent has a group child-element whose string value is 'narrowImage'.
I think you should be able to use:
//media_object[group='narrowImage']/file_url
This should select every media_object in your file (regardless of the level) then filter them based on group='narrowImage' then give you the file_url child.