[comp.sys.apple] A few IIGS programming questions

hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) (07/27/89)

I have a few sort of unrelated IIGS programming questions that I hope
someone will be able to answer for me.  If you include any examples, please
use Pascal or C.  Thanks.

1)  How can you lock/unlock files from a IIGS desktop application?  Destroy()
returns an error if I attempt to use it on a locked file.

2)  What is the format for the createDate, createTime, modDate, and modTime
fields of some of the ProDOS 16 records?

3)  How can I activate the scroll bars in an NDA window?  I'm writing an NDA
that uses scroll bars in its window, and I set up the window the same way I
do it for regular desktop applications, but the scroll bars don't respond
to mouse actions in the NDA window's scroll bars.  Is there something
different to do for NDA windows?

4)  Is there a way to tell the color of the pixel that the mouse cursor is
currently on?  I can't seem to find an appropriate toolbox call.

5)  Does anyone know how much it costs to upgrade (?) from the TML Pascal
stand-alone version to the APW version?  Also, is there a way to contact TML
Systems through the network?

Thanks a lot.


Jeff Hartkopf

Internet:
hartkopf@tramp.Colorado.EDU

farrier@Apple.COM (Cary Farrier) (07/27/89)

In article <10294@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) writes:
>1)  How can you lock/unlock files from a IIGS desktop application?  Destroy()
>returns an error if I attempt to use it on a locked file.

	From a desktop application, such as the Finder, you can select the
	icon of the file, then choose "Icon Info" under the "Special"
	menu, and it will bring up information about the file.  In the
	upper right hand portion of the information window is a check
	box called "Locked".  You can change the locked status of the
	file by toggling the check box (an "X" in the check box means
	that the file is locked).

	As for not being able to Destroy() a file:

	Each file on a ProDOS volume has an access attribute, which is a
	word value and is defined as follows:

		bits 15-8	reserved, must be zero
		bit 7		0 = destroy disabled, 1 = destroy enabled
		bit 6		0 = rename disabled, 1 = rename enabled
		bit 5		0 = backup not needed, 1 = backup needed
		bits 4-3	reserved, must be zero
		bit 2		0 = file is visible, 1 = file is invisible
		bit 1		0 = write disabled, 1 = write enabled
		bit 0		0 = read disabled, 1 = read enabled

	What you want to do is set the access parameter of the file so that
	bit 7 is a 1, thus enabling you to destroy the file.  Another reason
	that you may not be able to destroy the file is if it is currently
	open.

>2)  What is the format for the createDate, createTime, modDate, and modTime
>fields of some of the ProDOS 16 records?

	The createDate and modDate parameters are both words and
	follow this format:

		bits 15-9	year (1=1901, 2=1902,...)
		bits 8-5	month (1=January, 2=February,...)
		bits 4-0	day of month (1,2,...,31)

	So if you wanted to represent July 27th, 1989, you would use the
	following binary value:

		1011001011111011

	or in hex: B2FB, decimal 45819.

	The createTime and modTime parameters are also word values 
	and follow this format:

		bits 15-13	0
		bits 12-8	hour (0-23)
		bits 7-6	0
		bits 5-0	minute (0-59)

	So if you wanted to represent the time 8:41 (notice that the time
	is expressed using a 24 hour clock), you would use the binary
	value of %0000100000101001, hex $0829, decimal 2089.
 
Cary Farrier
+------------------------------------+
| #include "All.Standard.Disclaimers"|
+------------------------------------+

dlyons@Apple.COM (David Lyons) (07/28/89)

In article <10294@boulder.Colorado.EDU> hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M) writes:
>1)  How can you lock/unlock files from a IIGS desktop application?  Destroy()
>returns an error if I attempt to use it on a locked file.

What Cary said.  The calls you need to get and set the "access" word are
GetFileInfo and SetFileInfo.

>3)  How can I activate the scroll bars in an NDA window?  I'm writing an NDA
>that uses scroll bars in its window, and I set up the window the same way I
>do it for regular desktop applications, but the scroll bars don't respond
>to mouse actions in the NDA window's scroll bars.  Is there something
>different to do for NDA windows?

Before System Software 5.0, the system didn't make life very easy for NDAs
that want to have scroll bars.  You had to create the controls yourself,
inside the content of your window--this is a lot of work, since then you
have to track the controls yourself & be sure never to draw stuff over them
when you update the window.

Under 5.0 NDAs can use TaskMasterDA as easily as applications can use
TaskMaster; scrolling is no problem.

>4)  Is there a way to tell the color of the pixel that the mouse cursor is
>currently on?  I can't seem to find an appropriate toolbox call.

GetPixel in QuickDraw II should do it.

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.

jazzman@claris.com (Sydney R. Polk) (07/28/89)

From article <10294@boulder.Colorado.EDU>, by hartkopf@tramp.Colorado.EDU (HARTKOPF JEFFREY M):
> 
> I have a few sort of unrelated IIGS programming questions that I hope
> someone will be able to answer for me.  If you include any examples, please
> use Pascal or C.  Thanks.
> 
> 1)  How can you lock/unlock files from a IIGS desktop application?  Destroy()
> returns an error if I attempt to use it on a locked file.
SetFileInfo will unlock the file.  The attribute bits control this.  The
D bit is enabled to allow destroying, disabled to dissallow it.

> 2)  What is the format for the createDate, createTime, modDate, and modTime
> fields of some of the ProDOS 16 records?
I don't have my GS/OS manual here right now, but I am sure someone else
will help out.
> 3)  How can I activate the scroll bars in an NDA window?  I'm writing an NDA
> that uses scroll bars in its window, and I set up the window the same way I
> do it for regular desktop applications, but the scroll bars don't respond
> to mouse actions in the NDA window's scroll bars.  Is there something
> different to do for NDA windows?
You must be trying to use TaskMaster.  When I wrote an NDA (about two years
ago), you had to do a _FindControl and call _TrackControl with the handle
_FindControl returns.

> 4)  Is there a way to tell the color of the pixel that the mouse cursor is
> currently on?  I can't seem to find an appropriate toolbox call.
You could do a _GetMouse and read screen memory directly based on the
return point.

> 5)  Does anyone know how much it costs to upgrade (?) from the TML Pascal
> stand-alone version to the APW version?  Also, is there a way to contact TML
> Systems through the network?
Sorry, striclty assembly language here.


-- 
Syd Polk           | Wherever you go, there you are.
jazzman@claris.com | Let the music be your light.
GO 'STROS!         | These opinions are mine.  Any resemblence to other
GO RICE!           |  opinions, real or fictitious, is purely coincidence.

farrier@Apple.COM (Cary Farrier) (07/28/89)

In article <33518@apple.Apple.COM> dlyons@Apple.COM (David Lyons) writes:
>>4)  Is there a way to tell the color of the pixel that the mouse cursor is
>>currently on?  I can't seem to find an appropriate toolbox call.
>
>GetPixel in QuickDraw II should do it.

	Be sure to HideCursor() first, or you will always get black.

Cary Farrier
+------------------------------------+
| #include "All.Standard.Disclaimers"|
+------------------------------------+