Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 471045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:56:47+00:00 2026-05-12T23:56:47+00:00

I’m just starting to use MetroWerks CodeWarrior 1.1 For Mac 68k in a Mac

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:56:47+00:00Added an answer on May 12, 2026 at 11:56 pm

    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):

    DialogPtr myDlog;
    short itemHit;
    InitGraf( &qd.thePort );
    InitFonts();
    InitWindows();
    InitMenus();
    TEInit();
    InitDialogs( 0L );
    InitCursor();
    
    myDlog = GetNewDialog(myDlogResID, 0L, -1L);
    ShowWindow(myDlog);
    while (true) {
        ModalDialog(myDlog, &itemHit);
    }
    

    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:

    class NathanWindow {
    public:
        NathanWindow();
        virtual ~NathanWindow();
        void Initialize();
        void Click(short part, EventRecord *evt);
        void Show();
        void Hide();
        void Drag();
        void Move();
        // etc;
    protected:
        virtual WindowPtr MakeWindow() = 0;
        virtual void OnInit() = 0;
    private:
        WindowPtr _win;
    };
    

    then you will subclass this with code to call NewWindow() in the appropriate style.

    Initialize will look something like this:

    void NathanWindow::Initialize()
    {
        _win = MakeWindow();
        _win->refCon = this;
        OnInit();
    }
    

    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:

    void HandleMouseDown(EventRecord *evt)
    {
        WindowPtr win;
        short  thePart;
    
        thePart = FindWindow( eventPtr->where, &win ); 
        if (win) {
            NathanWindow *nw = (NathanWindow *)win->refCon;
            nw->Click(thePart, evt);
        }
    }
    
    void  EventLoop( void )
    {
        EventRecord evt;
    
        while ( true ) {
            if ( WaitNextEvent( everyEvent, &evt, kSleep, nil ) ) {
               switch (evt.what) {
               case mouseDown:
                   HandleMouseDown(&evt);
                   break;
            }
        }
    }
    

    and then Click will look like this:

    NathanWindow::Click(short thePart, EventRecord *evt)
    {
        switch(thePart) {
            case inGoAway: Close(); break;
            case inDrag: Drag(); break;
            case inGrow: Grow(); break;
        }
    }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.