Jump to content
petteri

Getting started with application development for System 6/7

Recommended Posts

Back to basics. I wrote a simple application to load PICT from resources and to display it using simple DrawPicture. Works fine as a stand alone compiled application but if I try the "Run" command on Think Pascal 4.5a1 and OS 9.2.2 I get an empty window. Is that some known issue?

 

Edit: Ah, the PICT was in 24bit image. I converted it to 1bit in GraphicsConverter and works fine now.

Edited by petteri

Share this post


Link to post
Share on other sites

Are you creating your own window, or relying on a THINK Pascal-produced standard drawing window from including InterfaceLib (or whatever it’s called ... been a long time)?  If the latter, my understanding is there are incompatibilities with later versions of MacOS, such as OS 9.  Ingemar’s website explains some of this http://www.think-pascal.org

 

I haven’t tried using THINK Pascal with anything after 7.5.5 personally so this is conjecture.  But try creating your own window with NewWindow instead of relying on the standard drawing window.  Or:  use THINK C.

Share this post


Link to post
Share on other sites

Hehe, this went pretty fast from a fun little hello world window to the dark misery. Things I suffered lately:

But with "Try Harder" mentality it is progressing. Deadline in February so I should be able to finish this by then...

Share this post


Link to post
Share on other sites

One more question. I want to have buttons straight on the window next to the picture without any dialog. These buttons would have direct effect on the picture without need of hitting any ok button.

 

Is it possible to use the standard buttons without dialog? Or should I go more low level and draw button looking image and figure out if mousedown happens on it? 

Share this post


Link to post
Share on other sites
8 hours ago, petteri said:

Is it possible to use the standard buttons without dialog

I was actually looking at some demo source code to do precisely this a few days ago and I cannot for the life of me remember where it was.  It might perhaps have been on @Mu0n's github page, which I can't find the URL for.

 

(This morning is going really well so far, as you can probably tell...)

Share this post


Link to post
Share on other sites

Yes, of course. 
 

The routines you need are NewControl (or GetNewControl if you want to put your control’s details in a CNTL resource - but that’s probably overkill), FindControl, and TrackControl. You will also need to call DrawControls when you get an update event if your window is modeless. These are covered in the Control Manager chapter of Inside Macintosh Volume I. 
 

In short:

 

- call NewControl to create your buttons 
- then, if you get a mouse down in your window from WaitNextEvent, call FindControl to see if it’s in a button

- if so, call TrackControl to deal with the button highlighting and see if the user does the mouseUp inside your button

- if so, your button has been pushed!
 

 

Share this post


Link to post
Share on other sites

Yeah that’s good. Just notice there that the first button (beepButton) takes action immediately upon a mouseDown before calling TrackControl, which is nonstandard behavior for a push button. Assuming you want a standard push button, wait until TrackControl returns before doing anything as with “beepButton2” here. 

Share this post


Link to post
Share on other sites

Alright, I have my copyBits animation stuff working with buttons and menus controlling it. I ended up creating three offscreens, two are for the static sources and one is for the staging area before copying everything to the screen. Might be a little bit excessive but no need to load pictures from the resources for each refresh. It even runs fine on my SE/30 with 7.5.5 :-D

 

Thanks again for the help!

Edited by petteri

Share this post


Link to post
Share on other sites
8 hours ago, petteri said:

Might be a little bit excessive but no need to load pictures from the resources for each refresh.

I have been deeply amused how much this thread has been a microcosm of scope creep, from "use the fake terminal" to full-on toolbox stuff.  Good fun, though, I don't mean that in any bad way. :D

Share this post


Link to post
Share on other sites
On 8/1/2020 at 8:39 AM, Mu0n said:

PopupFuncs is the correct name.

 

I have no recollection where I got it, but I have a vivid memory of having installed it a few weeks/months after I started using THINK C for my millions of little projects back in 2004-5.

 

Perhaps I got it from the hotline server that was up back then, Retromac68k (what a treasure trove, long gone, before I could manually back up it all - I got a good chunk of it though).

 

 

Thanks for this tip.  I just downloaded and PopupFuncs (with "technicolor!") is awesome!  I never saw this back in the day.  Super cool.

Share this post


Link to post
Share on other sites
On 8/3/2020 at 9:58 AM, Mu0n said:

YES! The intent of my website has finally paid off. 

By the way, what would be the proper way to redraw those buttons in case of updateEvt and when the application window is shown again. Without any redraw there is a white clipping.

Edit: Never mind, I didn't realize there is DrawControls

Edited by petteri

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×