I'm just starting to use MetroWerks CodeWarrior 1.1 For Mac 68k in a Mac System 7.5.5, but I need to know: How can I create a simple Form with a TextBox on it? Thanks.
Creating a Form In C++
6.3k Views Asked by Nathan Campos At
2
There are 2 best solutions below
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in FORMS
- Twitter Bootstrap horizontal form elements on a line
- posting javascript populated form to another php page
- Call a method in a .cs from javascript
- HTML5 form input reacting to enter key
- Why HTML5 required field is not mandatory, if form posted to two different pages using JavaScript?
- django form errors before submit
- PHP Contact Form returning error upon submission
- PHP form validation: Where to plop the code
- javascript check input fields are not blank and check input field length?
- Show success or error messages in Ajax response to Wordpress custom registration form
- Google forms to SMS
- SilverStripe - Multilingual Custom Form Template
- Backbone.Marionette + Rails app redirects after form submission. Why?
- Array not returning default value set over 1,000,000 when using jquery fancy comma script
- How to submit after using ng-repeat, ng-form and ng-submit
Related Questions in USER-INTERFACE
- Perl Command Line Interpreter crashing on exit
- Android - How to check for button click in a custom alert dialog box?
- Working towards a more advanced graphics game
- Use GUI displayed results of SQL query vs new queries?
- Efficiently design method to construct a Java GUI?
- Implementing callback function for dialog-based application
- Ui-router URL changes, nested view not loading
- Dont see anything inside my jframe
- Sliding Card Design
- Display value of Y axis inside GUI plot
- Sash becomes lost after resize
- Java Swing Drawing Rectangles
- How do I convert point to local coordinates?
- WPF Workaround to add Window control as a child of visual
- Developing multi page app like Viber interface using Qt Quick?
Related Questions in OBSOLETE
- How to show a specific hint within Visual Studio
- Programmatically discourage constructor initialization?
- Can't define variables after any operation?
- Why isn't ArrayList marked [Obsolete]?
- Obsolete an entire namespace?
- Old PhotoRate 2.0 designed to work on PHP 4 Does not now work
- <center> tag displays differently vs text-align
- How should I pass variables between independent parallel tcl procs/scripts
- Obsolete after a specific date?
- Uses for [Obsolete(string, bool)] attribute for .NET
- What happened to the *= and =* for outer joins in SQL?
- C# MongoDB Upsert - 'BsonValue(Guid) is obsolete: 'Use the BsonBinaryData constructor instead and specify a Guid representation'
- When, if ever, would you expect classes marked as obsolete to be removed from the .NET framework?
- How can I mark Perl code as deprecated?
- Creating a Form In C++
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There are a couple ways to do it. If your version of CodeWarrior has it, you would be best off using the PowerPlant framework. This is an application framework that makes it relatively easy to build applications that follow the Mac UI standards. It's been more than 10 years, so I have fully purged the PowerPlant class hierarchy from my memory. Sorry.
Another way to do this is to create a DLOG resource in ResEdit which includes a TextEdit field that more or less fits the window. Then you write your main app, which is going to include the typical toolbox initializations (I'm doing this TOTALLY from memory):
Which will probably work and is the most wrong way to do UI on the Mac, but if all you want is a box with a simple, simple UI, you'll be OK.
The problem with this code is that it doesn't handle the events well, the loop is infinite, there is no handling of cut/copy/paste, there is no honoring of menu events, and so on.
The Mac toolbox of that era requires you to do a hell of a lot more work than you might think. This is why there were libraries like MacApp, Think Class Library and PowerPlant - they provided OOP methods to handle a lot of the housekeeping crap for you. At the time that I did most of my Mac programming, I build a non-class library that was raw C code that made it easier to write layered windows (with floating palettes) and fluid UI without the overhead of OOP. Basically, I had to write a window manager, a menu manager, a dialog manager, an event manager, a command dispatcher and so on. When all was said and done, there was something like 18K of overhead to build a typical application. FYI, Acrobat Search on the Macintosh up until version 4 was built on this, as was Acrobat Catalog.
You can find canonical examples in MacTech, like this which is similar code to the above.
Before you start building your entire UI out of Dialog Boxes, all the old Macintosh tech notes said DON'T DO THIS. The DialogManager is one of the most abused chunks of Macintosh code there ever was. It was built for the purpose of making it easy to put of a box that says, "Are you sure you want to close 'Untitled'?" with an OK button and a cancel button. It's surprising how much it can be abused.
The real way to do things is to write a main that initializes the toolbox items, builds a basic menu bar then allocates an object that you design, say NathanWindow. NathanWindow might look like this:
then you will subclass this with code to call NewWindow() in the appropriate style.
Initialize will look something like this:
now, this last little bit is the tricky part - I've put a pointer to the NathanWindow into the Macintosh WindowPtr refCon field. Then you'll build an event loop in your main code that will look like this:
and then Click will look like this:
and so on.
And even still, this is (potentially) wrong in that you really want to have every NathanWindow to be hooked into an application parent that manages layers and groupings of windows.
A NathanWindow should contain a list of NathanControls. A NathanControl is something that can draw, responds to events, and so on.
All of this is in case you don't have PowerPlant, which does all of this for you. There was a reason why Apple liked to tout the line "it's hard to be easy", because the API that you had at your fingertips was so damn primitive.