How to set NSToggleButton to start in state 0 from Interface Builder? - objective-c

How can I in Interface Builder set NSButton of type toggle with Title and Alt.Title to start with the Title (e.g. the state 0)?
The moment I set the button as toggle and set the Alt.Title it displays Alt.Title in View and I can't find the option to set it to start in the 'default' state (state 0).
I could set it pragmatically but is there an option to set it in IB?
I've solved it before but forgot how.

Does unchecking the "state" checkbox not work for you? That should be all it takes.

Related

Remove Execute Button (ONLI) in ALV Scrren for cl_gui_alv_grid

How to remove the Execute button (ONLI) from the screen above ALV display in set_table_for_first_display?
I want to remove from ALV display screen, not from Main screen(selection screen) where user enters parameters?
The available events of cl_gui_alv_grid does not have fcode as 'ONLI'.
I assume you are using the class cl_gui_alv_grid to show the ALV-Grid and you don't mean the toolbar of the ALV-Grid. The GUI status (execute and other buttons) are normally set in your program with the command SET PF-STATUS. Now you can remove it dynamically with
DATA: exclude_buttons TYPE slis_t_extab.
APPEND 'ONLI' TO exclude_buttons.
SET PF-STATUS 'MY_STATUS' EXCLUDING exclude_buttons.
or you remove the button statically from the GUI status.
The solution was simple.
I just added SET PF-STATUS ' ' before the ALV call and it worked.

Modify properties for individual controls in the details section of a form in continuous forms view

I have a form with a default view set to continuous forms. I want to set the enabled property of a command button control to disabled for records that have a null value in a specific column.
Short answer, you can't. What you need to do is start the button routine with an IF statement that says if the required control is null then exit sub. That way the button won't do anything if the field has a null value
Try setting the caption in the Detail_Paint event for the form:
cb_SetSpecies.Caption = [Species_Name]
This allows a different value to be set for each record.

Set UltraGrid to ReadOnly property, vb.net

In my project, I have a form that has 3 radio buttons, an ultragrid, and a textbox. When I load the form, I want the ultragrid to be ReadOnly, or the equivalent of this, and then I want it to become active again when rbCategory is checked (one of the radiobuttons). I then need it to be set to ReadOnly again if one of the other 2 radio buttons are selected.
I feel like ReadOnly is not a property that can be used with Ultragrids, so what is the equivalent (to make it grey, like a ReadOnly textbox, basically), and how is this coded?
I tried using
ugCategories.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False
but this didn't seem to do the job
By setting AllowUpdate you are actually making the grid read-only. If you need to change the grid appearance you need to set appearance for the read-only cells like this:
ugCategories.DisplayLayout.Override.ReadOnlyCellAppearance.BackColor = Color.Gray;
Further, you may consider set and the CellClickAction to CellSelect like this:
ugCategories.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect;
You may also check this article for more helpful information from Mike Saltzman - Infragistics Win Forms Guru

Save a user popup selection in a custom Automator Action

Using Xcode 5.* for a cocoa-applescript automator action.
Interface is a a simple popup menu that gets populated using an outlet with:
tell thePopupMenu to removeAllItems()
tell thePopupMenu to addItemsWithTitles_(theList)
When the action is used in a workflow (a Service actually), I want the next time it is run and the action dialog shows up (I will have "Options:Show when run" selected), I want the popup menu to change the selection to the last one that was selected. Right now, the default first item shows, even though last time it was run, the user selected a different item in the popup menu.
My thought was that I need to capture a change in the popup menu with a Sent Action handler, and then set some type of default. I have a working handler:
on thePopupMenuSentAction_(sender)
set popupValue to (popupSelectedValue of my parameters()) as string
-- save this selection somewhere???
end
What's the right way to save this? Do I use User Defaults? My Bindings are currenly all tied through Parameter object/controller. If I should use User Defaults, can someone give example code for setting up User Defaults, and then how to get and set a new value using Cocoa-Applescript?
If I can get the name string of the menu item saved somewhere, I can get the string and then change the selection of the popup menu in the
on opened {}
-- set up the action interface
end
handler which gets called just before the action is displayed each time.
Thanks for any help,
Joe
I did mine a bit differently. I will assume you are referring to what XCode calls a "pop up button" (somewhat misleading). I did not use the parameters at all, although that is probably better for larger projects. Have a look at the code:
script Insert_Picture_into_Powerpoint_Slide_Show
property parent : class "AMBundleAction"
property menuChoices : {"Insert a Beginning", "Insert at End"}
property menuSelection : missing value
if (menuSelection as string) is "missing value"
set menuSelection to 0 as integer -- sets default value
end if
end script
I bound Content Values to File's Owner and under Model Key Path I put menuChoices.
Then you just bind the Selected Index to File's Owner and for the Model Key Path type menuSelection.
Defaults
On the initial run, if the user does not click anything, the menuSelection will be missing value. Because I couldn't find a way around this, I created a conditional which tests for this and sets it to the first choice by default (the one that is shown when you add the action).
When the user selections one of the menu choices, the choice is remembered on sequential runs.

Hiding NSSlider's tick marks

Is there a way to hide the tick marks of NSSlider?
If you want to keep the tickmark stopping behaviour but hide them, you can override the NSSliderCell's -(NSRect)rectOfTickMarkAtIndex:(NSInteger)index
and provide a rectangle with 0 dimensions.
You can use the -[NSSlider setNumberOfTickMarks:] method to set the number of tick marks to zero. This will hide them.
In Interface Builder you can just set this to zero in the inspector panel.
You can override [NSSliderCell drawTickMarks] and do nothing in your implementation.
Make sure to set your subclass as the NSSlider's cell.