Can I create a new element on a screen by coding blocks? - app-inventor

In MIT App Inventor, can I create a new element (eg. a new textbox, button, label) on a screen by coding blocks, instead of drag&drop it via the Designer?

Related

Where is the Monotouch Dialog UI Picker Element?

Wheres the custom picker element for monotouch dialog (Xamarin.IOS)?
// update
UIPickerView would be a wonderful element to have as a monotouch dialog element along with UIActionSheet.
Instead I journeyed into building one by hand and then attempted to fit it into an UIActionSheet. Was couple of days work (I'm a noob) but got stuck trying to clean up the aesthetics of it (think I'll just stick with a 'ok' solution of embedding the picker inside a table for now).
Just in case anyone else embarks on this adventure here's a link to make your picker:
https://www.youtube.com/watch?v=lXa9WZMcmoE
Here's a link to how to setup a UIActionSheet:
http://monotouch.2284126.n4.nabble.com/UIActionSheet-Presenting-action-sheet-clipped-by-its-superview-warning-td3897607.html
// another update
Although not a custom picker element using MT.D, you can sort of have a popup picker by linking the input view of a control (view object i.e. text field) and set it's input view property to the picker. The picker slides in from bottom whenever you click this control. Think I just have to implement a custom view with my own picker and a cancel button somewhere...hmmmm:
http://nomtek.com/tips-for-developers/working-with-pickers/
Your update is correct - you'll want to create a custom MT.D element that inherits from EntryElement, override the method that creates the UITextField and set the field's InputView to an input view of your choice. I actually just wrote a tutorial on this: Custom MT.D Input View & Element

'Embed Objects In' menu items are all disabled. How to enable?

I'm following the instructions for creating a ScrollView in the book 'Cocoa Programming for Mac OS X, 3rd Edition'. I'm using Xcode 3.2.3.
I've already created a view, into which I've drawn shapes and lines.
The next task is to convert this to a NSScrollView, which according to the book should be a simple case of selecting the existing view and choosing Layout -> Embed Objects In -> Scroll View.
However whatever object I select, the items in the 'Embed Objects In' menu are all disabled.
How can I enable the Embed Objects In -> Scroll View item?
Got it. The important thing here is not to try selecting the view in the MainMenu.xib window. Select the view in the actual document window and make sure the resize handles are visible. A little fiddly, but once you get the right object selected, then the embed objects menu items become enabled.

Any layout/geometry management for Cocoa?

If i create WinForms / Qt / Gtk application i use so called "layout managers" (or "geometry managers") to automatically layout my UI according to text inside widgets and my instructions. For example, if i layout a window with big edit field and 2 buttons below it aligned right i write following code "Create a window with vertical layout manager. Add edit widget as first item and horizontal layout manager as second item. For horizontal layout manager add spacer as first item, button as second and button as third". My window will be automatically resized according to button labels and edit field size. Also, if i resize my window all items will be resized automatically.
Is it something like layout managers for OSX? I have found that NSView can be added into hierarchy, but i can't find any ways to instruct parent NSView something like "arrange child NSViews vertically".
You should read about Cocoa Auto Layout, new in OS X 10.7.

How to change the point to slide a (cocoa) custom sheet?

I would like to use in my Mac App a mainwindow with a title bar with custom height (like sparrow, twitter app, reader for mac and others).
I´m using https://github.com/indragiek/INAppStoreWindow for this and it works perfect.
I would like to use also some custom sheets. The problem is that this sheets are open sliding from the bottom of the REAL titlebar that means the middle (more or less) of the new FAKE titlebar (and looks really bad).
Any idea how to change the point the custom sheets have to slide?
Set an object as the delegate of the NSWindow that the sheet is attached to, and implement the ‑window:willPositionSheet:usingRect: delegate method.
You can then modify the proposed position of the sheet and return a revised NSRect.
The rect that you return indicates the position, width and behaviour of the opening animation, it doesn't control the width of the resulting sheet.
Have a look at the docs about positioning sheets for more info.

Qt Action Dropdown Widget

I am creating a drawing application where the user can insert primitive shapes, like circles, triangles, etc. In the toolbar, I would like to have a single "Add Shape" button that shows a dropdown widget when pressed. In the dropdown, I would like to have a grid of QAction icons representing the different shapes the user can add. This is almost identical to how one adds basic shapes in powerpoint.
I know how to create a dropdown menu using a QToolButton and setMenu. However, this lists actions in a traditional menu format. I want the QActions showing only their icons, and to have them arranged in a grid - like a toolbar that has multiple rows. Do I have to create a custom widget for this?
Thanks!
By default QMenu uses a vertical layout to display the QActions so If you want a grid you need to subclass it to create your custom one.

Resources