How to pass <list_items> to a PULLDOWN DIALOG as a variable? - trace32

In a PRACTICE script, how do I pass a list of items to a pulldown dialog as a variable. I have tried the following, but it doesn't seem to work.
&myFiles="foo,bar,baz"
DIALOG
(
OptionA.SEL: PULLDOWN &myFiles ""
)

From the PRACTICE Script Language User’s Guide (practgice_user.pde):
Use (& or (&+ as opening block delimiter to switch ON macro expansion ...
The following works as expected:
&myFiles="foo,bar,baz"
DIALOG
(&+ ; <-- note this
OptionA.SEL: PULLDOWN &myFiles ""
)

Related

Attachments moved away from Item after validation and before submit process in Apex

I have multiple File Browser Item fields on one page of Application in Oracle Apex.
What happens: When I miss any Item for which validation error fires, I want to hold that file to the browser but I usually loose it if I get that validation error. Is there a solution for the same like other Items fields hold previous value except File Browser Item field. Please see below ss:
Anshul,
APEX 4.2 is very old and no longer supported. A later (or preferably latest) version of APEX will behave differently as Dan explained above.
Can you import your application into apex.oracle.com (which is running APEX 20.1) and you will probably see better results. Based on this you can hopefully use it as justification to upgrade your environment.
Regards,
David
Go to your page-level attributes and a function like the following in the Function and Global Variable Declaration:
function validateItems(request) {
var $file1 = $('#P68_FILE_1');
var $file2 = $('#P68_FILE_2');
var errorsFound = false;
if ($file1.val() === '') {
errorsFound = true;
// Show item in error state
}
if ($file2.val() === '') {
errorsFound = true;
// Show item in error state
}
if (!errorsFound) {
// I think doSubmit was the name of the function back then. If not, try apex.submit
doSubmit(request);
} else {
// Show error message at top of page, I'll use a generic alert for now
alert('You must select a file for each file selector.');
}
}
Then, right-click the Create button and select Create a Dynamic Action. Set the name of the Dynamic Action to Create button clicked.
For the Action, set Type to Execute JavaScript Code. Enter the following JS in code:
validateItems('CREATE');
Finally, ensure that Fire on Initialization is disabled.
Repeat the process for the Save button, but change the request value passed to validateItems to SAVE.

Unchecking checkbox in oracle apex

Created an report with checkbox using apex_item and when checked more than one check box i will display alert message "not to check more than one checkbox with ok button " after clicking ok it should be unchecked . please find my JavaScript code that displays alert message
if($("input[type=checkbox]:checked").length > 1)
{
var msg = alert('You are not allowed to select more than one employee');
}
It's best to use the APEX JavaScript APIs for this type of thing. You can find them here: https://apex.oracle.com/jsapi
If you're getting started with JavaScript and APEX, you may find these slides useful: https://www.slideshare.net/DanielMcGhan/getting-started-with-javascript-for-apex-developers
Here's a solution that should work for you (just change the name of the item to match yours):
var cbItem = apex.item('P1_CHECKBOX');
if (cbItem.getValue().length > 1) {
alert('You are not allowed to select more than one employee');
cbItem.setValue(); // Passing nothing to clear the value
}

How can I clear the focus from a desensitized GtkWidget - GtkSpinButton with property sensitive = false

Background: I have a few tabs set up in my GtkNotebook, and when certain conditions are met on the main tab, then input fields in the 'test signals' tab are accordingly disabled.
When the input inside a GtkSpinButton is highlighted on the 'test signals' tab and the GtkSpinButton's property sensitive is set to false, the text within the GtkSpinButton remains highlighted. Because sometimes there are no other editable fields on this tab, the text remains highlighted until another widget has its property sensitive set to true.
This just looks sloppy to me, so I would like to stop this behavior and have the widgets that are set to sensitive = false all cleared of focus or highlighting. Any idea how to un-highlight the text within the GtkSpinButton, maybe before setting sensitive = false?
To get rid of a selection you can use the gtk_editable_select_region() function. This is a method on GtkEditable, an interface that both GtkEntry and GtkSpinButton satisfy. You can convert either of these to GtkEditable with GTK_EDITABLE(). For example:
gtk_editable_select_region(GTK_EDITABLE(spinbutton), 0, 0);

WXPython: getting the initial value of a combo box

In a dialog box I have a combo box and a text field. I would like to make so that if one particular value in the combo box is selected, the text field would be disabled (or hidden), and if another value is selected, the text field would be enabled.
I have:
self.myCombo = wx.ComboBox(parent=self, choices=['value1', 'value2'], style = wx.CB_READONLY)
self.myCombo.Bind(wx.EVT_COMBOBOX, self.onChange)
# ...
def onChange(self, ev):
self.myTextField.Enable(False) if self.myCombo.GetValue() != "value1" else self.myTextField.Enable(True)
And this does work like a charm, the text field gets enabled and disabled.
However, I would like to have the text field enabled or disabled depending on the initial value of the combo box, meaning the value gotten from a config file and selected when the dialog box is open.
I've tried the same:
self.myTextField = wx.TextCtrl(parent=self)
self.myTextField.Enable(False) if self.myCombo.GetValue() != "value1" else self.myTextField.Enable(True)
but this doesn't work. I've tried GetSelection also, but when logging this, both GetValue and GetSelection return -1.
The combobox probably isn't fully initialized yet when you try to query it. If you want to disable it when it loads, you don't have to check its value. Just disable it. But for what you want to do, I would recommend using wxPython's wx.CallAfter() method.
Something like the following should suffice:
def __init__(self):
# initialize various variables
wx.CallAfter(self.check_combobox, args)
def check_combobox(self, args):
self.myTextField.Enable(False) if self.myCombo.GetValue() != "value1" else self.myTextField.Enable(True)

How To Create A CheckBoxList in Maya

i want to create a checkbox list in Autodesk Maya (MEL only) which contains N number of items along with a check/ uncheck option next to it. so that on click of a button i can get value of all checked or unchecked items. There is a component called textscrolllist but it does not support checkbox.
Check out the "Controls" category in the MEL reference, you will find the checkBox and checkBoxGroup commands. You can query the state with the -value or -valueN flags.
Check out this site. This has helped me over the past few years when it comes to creating custom UIs in mel. Below is some block text on how to create a checkbox within a UI.
https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/GUI_controls.html
// a function to be called when the checkbox gets checked.
proc on_func() {
print("checkbox on!\n");
}
// a function to be called when the checkbox gets unchecked.
proc off_func() {
print("checkbox on!\n");
}
{
// create a window
window;
// define the layout of controls added
// to the window.
columnLayout;
// create a checkbox
$c = `checkBox -label "thingy"
-onCommand "on_func"
-offCommand "off_func"`;
// show the window we last created
showWindow;
// to get the current value of the checkBox, use the -query flag
$value = `checkBox -query -value $c`;
print("check_box value = "+ $value +"\n");
}