Modifying NSDatePicker for automatically generated predicate row templates - cocoa

How can I modify the NSDatePickerElementFlags for the NSDatePicker in row templates for NSDate properties returned by [NSPredicateRowEditorTemplate templatesWithAttributeKeyPaths:inEntityDescription:]? I would like the NSDatePicker to show hrs:minutes as well as the date.
Update
I've added an answer below, gleaned from the cocoa-dev list.

You can probably grok through the templateViews of the returned row templates to set this property.

Per Peter Ammon, on cocoa-dev, and as Ben notes, the easiest way is to modify the date picker in -templateViews directly:
[[[template templateViews] objectAtIndex:2] setDatePickerElements:...]
According to Peter, the order of elements in -templateViews is guaranteed to be constant.

Related

ODI KM Option - value from FLEX FIELD

Do you think that it's possible to take a value into an ODI IKM Option (for example) from a flexfield?
Example:
You define a flex field on the target table and then pass the value in the IKM.
Then, reading the variable, it's possible to pass it to an option from the IKM?
Thanks,
After searching I found that it's not possible to do it. Conditional Expression can take predefined values. You can find in the next all the combinations:
Condition Expression – It allows you to set the required condition for
the selected option. Double-click the field for editing the condition
expression for the selected option. Click the browse icon Browse icon,
to launch the Edit Expression Editor, which enables you to create or
edit the existing groovy script that determines whether a knowledge
module should be enabled, disabled, displayed or hidden.
Examples are:
return
options.getValue("Cache").equals("true")?"show=true,enable=true":"show=false,enable=false";
This looks at the value of another KM Option called "Cache". If its
value is "false," then the KM Option is hidden, because it's not
relevant.
return
(isStreaming)?"show=false,enable=false":"show=true,enable=true";
This looks at the Mapping isStreaming property. If it's true, then
this option is hidden.
source
It is very easy to do.
You may use odiRef.getTable(java.lang.String pProperty) in the code of your IKM. One of possible values for pProperty is the code of your FlexField.
If you like to pass if through the option just pas <?…?>-substitution as a value of the option. (Probable you should play with %- or ?-substitutions, which is working.)
Refer to «Substitution API Reference» on Oracle site. Many functions like getTable, getIndex, getAK, getContext and others can obtain flexField value of an object of the corresponding type.
Additionally there is the odiRef.getFlexFieldValue() method. It gets the value of any object of any type, but it is required to pass internal IDs as an argument. So it is not convenient.

Read Dates as Strings with Spreadsheet Ruby Gem

I have been looking for a way to read out an Excel spreadsheet with keeping the dates that are in them being kept as a string. Unfortunately I can't see if this is possible or not, has anyone managed to do this or know how?
You may want to have a look at the Row class of the spreadsheet gem:
http://spreadsheet.rubyforge.org/Spreadsheet/Row.html
There's a lot that you can get there, but the Row#formatted method is probably what you want:
row = sheet.to_a[row_index] # Get row object
value = row.formatted[column_index]
The formatted method takes all the Excel formatting data for you and gives you an array of Ruby-classed objects
I think you can try row.at(col_index) method..
You can refer to this page

In jqgrid, Is it possible to use select formatter without setting editoptions?

Since one of my jqgrid column is not editable,so I do not set required value info i.e.{value:"1:John;2:Smith"} to editoptions, instead, I set formatter:select and value info to formatoptions. When I look at the js sourcecode of select formatter it tightly coupled with editoptions especially for getting "multiple" property of it. Is it possible to achieve this without writing custom formatter?
formatter:select
formatoptions:{value:"1:John;2:Smith"}
data being sent to this column is "1" or "2", and I expect from jqGrid to display John or Smith.
thanks,
Alper.
You are right, that the code of the select formatter could be improved to use opts.colModel.formatoptions.multiple in the line in the same way as it will be used opts.colModel.editoptions.multiple in the line of code.
Nevertheless I don't think that it's a real problem. If you has no editable property in the column or if you has editable: false the column stay non-editable even if you use editoptions.
So I agree you that the usage of formatoptions.multiple would be better, but I think that it's "nice to have" problem only.

NSDateFormatter completion

I have an NSTextField with NSDateFormatter. The formatter accepts 'mm/dd/yy'.
Is it possible to complete the date automatically? So the user can type 'mm' and the formatter completes the current month and year.
Any particular reason you don't want to use an NSDatePicker? (It does require 10.4 and later, but that's less of an issue these days)...
No.
You are going to need some logic that detects when "mm" is present in the text field and then get the current date from NSDate and then pass that into the date formatter to get the string and then display it in the text field.
You could also investigate the various delegate methods available to NSTextField. If my memory serves me right, there is didBeginEditing (which is inherited from NSControlTextEditingDelegate, check that class reference). However, I'm not sure if that fires every time you input a new character...though it may. In which case it'd be a case of assigning a delegate that checks the NSText string and does a little comparison.

How can I remove columns from a QTreeView (using QDirModel)?

I have a QDirModel attached to a QTreeView and I only want to see the paths, not size, type and date modified.
Is there a way to remove these columns?
QTreeView::setColumnHidden(int column, bool hide) should do the trick.
One can also use hideColumn(). Something like:
for i in range(1, self.my_tree_view.header().length()):
self.my_tree_view.hideColumn(i)

Resources