using combobox value - pygtk

Thanks S. Lott for your prompt reply.
My question was about this link in my first post:
Python GTK adding signal to a combo box
I want to reuse the changed value of the combo in the main window GUI
Is it possible this way, and how ?
Thanks for some explanations
Best regards

If you are using a ComboBox with your own custom model, you can always get data for selected item:
index = combo.get_active()
model = combo.get_model()
item = model[index]
print item[0] ## , item[1], ...
But if you are using a text combobox (created with gtk.combo_box_new_text()), that's easier to use:
item_text = combo.get_active_text()
print item_text

Related

Problem with Enable/Disable a button on SALV Full Screen

Dear all I need your help on the below desperately.
I have created an ALV from SALV and I have copied a GUI Status SALV_STANDARD from a standard program. Firstly I added 2 buttons the POSTNEW & POSTDIFF and after a day I added the SELECT button.
Depending on the selection of the user I want to enable or disable the buttons according to the business requirements.
I have this code in a procedure:
r_alv type reference CL_SALV_TABLE.
if status_name is not initial and report_name is not initial.
set pf-status status_name.
r_alv->set_screen_status(
pfstatus = status_name
report = report_name
set_functions = r_alv->c_functions_all ).
endif.
data: lit_functions_list type salv_t_ui_func,
lwa_functions_list like line of lit_functions_list.
r_functions = r_alv->get_functions( ). "Get Toolbar functions
lit_functions_list = r_functions->get_functions( ).
if i_button_name is not initial.
** Now hide the BUTTON
loop at lit_functions_list into lwa_functions_list.
if lwa_functions_list-r_function->get_name( ) = i_button_name.
lwa_functions_list-r_function->set_visible( i_button_visable ).
endif.
endloop.
endif.
The variables status_name, report_name, i_button_name and i_button_visable are parameters of the procedure and I think that their names show what they are carrying.
The internal table lit_functions_list has 60 records and the last 2 have data for the first 2 buttons and this is the reason that I can enable/disable them.
But there is no record with my 3rd button SELECT. Instead there is a record with the button MYFUNCTION which I have already deleted.
Can someone tell me what to do in order to have the 3rd button available in the lit_functions_list?
Can someone tell me why this itab has so many garbages?
Thanks in advance
Elias
Even I had the same problem. After I ran the report BALVBUFDEL it solved the issue.
Newly created buttons now coming inside the function list ..
lit_functions_list = r_functions->get_functions( ).
For Adding 3rd button in the lit_functions_list, You can use below code.
r_functions->set_function( NAME = 'BUT3' BOOLEAN = 'X' ).
you can also use add_function to add new button.
try.
r_functions->add_function(
name = 'BUT3'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
itab does not have garbage. It contains all the data related to status like menu bar, application tool bar and function keys.
Finally I found the answer at least to my problem. Let me describe again what I did:
I copy the GUI Status from the standard program SALV_DEMO_TABLE_FUNCTIONS to my program through Tcode SE41. I added 2 buttons POSTNEW & POSTDIF. Until now all working perfect and I can Enable/Disable these 2 buttons.
Next day the business asked me to add a button SELECT with which the user can make editable the corresponding SELECT column of the itab in order to choose which record to be posted. And here started my problem where the itab with the functions didn't contain the last created button SELECT. What I did was, I created a button through the design process of the GUI Status but I could not get it through the below code:
lit_functions_list = r_functions->get_functions( ).
With your answers I found other problems in my code but still I could not get the new button in the above itab.
Finally, yesterday evening I remembered, what someone told me in the past. In old systems (like oursSAP ECC 6.0 R701 SP007) sometimes the ALV buffer stuck and we have to reset it. So I run the program BALVBUFDEL and vuala the button SELECT appeared in the itab and I can now Enable or Disable.
So keep in mind that sometimes the ALV buffer needs a reset.
Thanks all for your help.
Elias

Acrobat XI Forms - Radio Button Action on click

In a fillable form, I would like the two adjacent fields to become shaded (no input available) if the N/A radio button is selected. If either the Yes or No radio button is selected, I would like the first adjacent field to take the value from the PointValue field. How would I accomplish this? Thank you for your help.
That can be accomplished in various ways. One possibility would be the following, which you add to the form logic calculation script (if this is the only one, then be it), which you attach to a hidden (text) field whose sole purpose is to provide a holder for the form's calculation logic. BTW, this approach is considered best practice for a smart form, because it gives maximum control over the calculations, and creates the most efficient form.
Anyway, let's assume the group of checkboxes or radiobuttons is named "mySelect", and the field with the result/to be greyed out is named myResult. The return value of the n/a button shall be "na"
Then, you would have the following piece of code in the calculation script mentioned above:
if (this.getField("mySelect").value != "na") {
this.getField("myResult").readonly = false ;
this.getField("myResult").strokeColor = color.gray ;
this.getField("myResult").value = this.getField("mySelect").value.toString().replace(/Off/gim, "") ;
} else {
this.getField("myResult").readonly = true ;
this.getField("myResult").strokeColor = color.blac, ;
this.getField("myResult").value = "" ;
}
And that should do it.

How to lock combobox so that the text and items cannot be modified/delete/erased?

Is it possible lock the combobox so that the text can not be deleted/erased or modified. And make only choose the items? Thank you in advance. Hope is it possible.
Set the "DropDownStyle" property of the combobox to DropDownList.
This will allow only items in the list to be selected and will not allow any user input:
Option 1
Simply set the ComboBox.Enabled to False - that way they can't change the values!
Option 2
Otherwise, use the dropDownStyle:
make DropDownStyle property to DropDownList instead of DropDown
For more information
Read this article (yes, it's written in c#, but the properties are the same!)
the above image displays this quite well.
EDIT
There is also a question previously asked here that asked a similar question.
You can set ComboBox.DropDownStyle to ComboBoxStyle.DropDownList.

In Livecycle forms make all negative values red

I'm building a form in Adobe Livecycle and would like all negative numbers to display in red. I can accomplish that on individual elements by attaching this code to the exit event:
form1.#subform[0].Table3[0].HeaderRow.concessions1::exit - (FormCalc, client)
if ($.rawValue <0) then
$.font.fill.color.value = "255,0,0"
else
$.font.fill.color.value = "0,0,0"
endif
Currently I have to add this code to every single field, is there a way to make this script run on multiple fields without retyping it for each one?
Thanks
your options are:
Externalize the code in a script object and call the method on the exit event. You can pass the field as an input parameter so that your code is generic.
If you want to do this before a form is submitted, you can create a method that loops through your form fields and reference this code to highlight the negative values.
I hope this helps. Let me know if you have any more questions.
Thanks,
Armaghan.

ComboBox that remembers recently entered values and can autocomplete

I'm developing a Desktop Search Engine in VB.NET
I'm using a ComboBox to specify the search query (string).
I want the ComboBox to remember and display recent queries.
I also want the ComboBox to try and Autocomplete the queries as the user is typing.
What is the best way to implement this?
This can no doubt be done more elegantly, but here's the basic principles (apologies for any syntax issues, I'm not much of a VB guy):
In the KeyUp event:
Make sure the key in't a navigation key:
if e.KeyCode <> Keys.Back [...]
Search the items list for the text typed:
idx = myCombo.FindString(myCombo.Text)
Take the combo's found item:
s = myCombo.GetItemText(idx)
insert it into the .Text property:
myCombo.Text = s
Note that this would overtype everything the user entered (destroying case). You could improve this by appending the 'missing' part instead:
stringToAppend = s.SubString(myCombo.Text.Length)
myCombo.Text = myCombo.Text + stringToAppend
Finally, select the new text so they can keep typing:
myCombo.SelectionStart = myCombo.Text.Length - stringToAppend.Length
myCombo.SelectionLength = stringToAppend.Length
You might also want to look at this from vbAccelerator.com, offered as a basic starting point for auto-completion in VB.NET. The vbAccelerator code is usually high quality.