[comp.sys.mac.programmer] problems...

gerhard@arizona.edu (Gerhard Mehldau) (09/05/89)

Can someone out there help me with the following two problems?

(1) I'm currently working on an image processing application which starts out
    by resetting the color table (no flames, please!). Having done that, it
    needs to redraw the desktop in its original color/pattern. InitWindows()
    works fine under Finder, but doesn't do anything under MultiFinder.
    Any ideas?

(2) The File Menu in the same application has an "Import" item which uses
    SFPGetFile() together with a customized dialog. The DLOG and DITL resources
    for this dialog are ResEdit'ed copies of the original resources that are
    used with SFGetFile(). The dialog contains several TextEdit items; however,
    tabbing doesn't move the I-beam cursor as it does in other dialogs.
    What am I doing wrong?

Any opinions/comments/code would be appreciated!

-- 
-> Gerhard Mehldau
   Dept. of Computer Science	internet: gerhard@arizona.edu
   University of Arizona	uucp:     {cmcl2,noao,allegra}!arizona!gerhard
   Tucson, AZ 85721		at&t:     +1 (602) 621-4632

pepke@loligo (Eric Pepke) (09/05/89)

In article <13707@megaron.arizona.edu> gerhard@arizona.edu (Gerhard Mehldau) writes:
>Can someone out there help me with the following two problems?
>
>(1) I'm currently working on an image processing application which starts out
>    by resetting the color table (no flames, please!). Having done that, it
>    needs to redraw the desktop in its original color/pattern. InitWindows()
>    works fine under Finder, but doesn't do anything under MultiFinder.
>    Any ideas?

Clearly, if you change the entire color table, the desktop cannot be drawn 
in its original color and pattern.  The most you can hope for is a best 
guess of what the colors would be in the new table.

If the latter is what you need, you can come close by using the Palette
Manager.  Don't mess with the color table directly, but associate with your
window a palette of tolerant colors with the tolerance of each set to zero.
Every time the palette is changed, various managers and applications 
themselves will try to redraw the world to look as good as possible in the
new world.  Sometimes they even come close.  

However, you may find the flashing caused by the redrawing annoying.  NCSA 
Image uses a different approach which avoids the flashing but which leaves 
strange icon colors when run under MultiFinder.

Eric Pepke                                     INTERNET: pepke@gw.scri.fsu.edu
Supercomputer Computations Research Institute  MFENET:   pepke@fsu
Florida State University                       SPAN:     scri::pepke
Tallahassee, FL 32306-4052                     BITNET:   pepke@fsu

Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.

wetter@cup.portal.com (Pierce T Wetter) (09/12/89)

To redraw the desktop you need to call PaintBehind with a big rectangle for 
the front window.

 Why do you need to jam the CLUT? Why can't you just use the Palette Manager
and allocate a palette of 256 colors for your window? That way when your window
is in front, you have all your colors. When its not, the system CLUT is active.

Pierce

chaffee@reed.UUCP (Alex Chaffee) (09/13/89)

In article <13707@megaron.arizona.edu> gerhard@arizona.edu (Gerhard Mehldau) wr
edu> gerhard@arizona.edu (Gerhard Mehldau) wr!
>(2) The File Menu in the same application has an "Import" item which uses
>    SFPGetFile() together with a customized dialog.
...
>    The dialog contains several TextEdit items; however,
>    tabbing doesn't move the I-beam cursor as it does in other dialogs.
>    What am I doing wrong?

Relax -- it's just Standard File interpreting Tab to mean Change Volume.  Try
it with a floppy in your drive and you'll see what I mean...

Now, I don't know how to keep SF from doing this -- Any net leads?

>-> Gerhard Mehldau

-- 

Alex Chaffee
chaffee@reed.bitnet
____________________

tim@hoptoad.uucp (Tim Maroney) (09/16/89)

In article <13707@megaron.arizona.edu> gerhard@arizona.edu (Gerhard Mehldau)
writes:
>(2) The File Menu in the same application has an "Import" item which uses
>    SFPGetFile() together with a customized dialog.
>    The dialog contains several TextEdit items; however,
>    tabbing doesn't move the I-beam cursor as it does in other dialogs.
>    What am I doing wrong?

In article <13295@reed.UUCP> chaffee@reed.UUCP (Alex Chaffee) writes:
>Relax -- it's just Standard File interpreting Tab to mean Change Volume.  Try
>it with a floppy in your drive and you'll see what I mean...
>Now, I don't know how to keep SF from doing this -- Any net leads?

Pretty easy.  The SFPGetFile call needs to be passed an event filter
parameter that does the necessary thing, then nullifies the event
or otherwise signals that the event should not be processed any further.
Check for a key-down event with the code for tab (0x9) and TESelect
to pick the non-selected field.  Assuming you do this with a switch on
the character code, here's a case in C that does it:

	case 0x9:
		switch (EditField(dlog)) {
		case text1: tmp = text2; break;
		case text2: tmp = text1; break;
		}
		SelIText(dlog, tmp, 0, 32767);
		*item = 0;
		return true;

The function EditField is my anal-retentive way of pretending not to
look at data structures; whether it's a macro or a routine, the value
is ((DialogPeek)dialog)->editField + 1.  This approach can readily be
adapted for more items simply by adding more cases, each of which
selects the (circular) next item.

You can also do a similar trick with arrow keys, but I recommend doing
it only for the left and right arrow keys, so as not to interfere with
the standard file keyboard selection shortcuts.  Unfortunately, if
you have even one TextEdit item in a get file dialog, then the user
can't select from the keyboard by typing the file name, so consider
use of this feature very carefully.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"It is better to be a human being dissatisfied than a pig satisfied;
 better to be Socrates dissatisfied than a fool satisfied."
	-- John Stuart Mill, UTILITARIANISM (1863)

emork@ulrik.uio.no (Erling Mork) (05/15/91)

I have three (3) problems/questions for the mac community:

1.  I want 7.0 (dont we all).  I got connected to ftp.apple.com but lost
the connection as I was downloading the stuff.  Now I can't get up again...
the thing times out.  ???

2.  I have a Mac IIsi 5/40 with extended keyboard II.  My command-onkey
"interrupt switch" won't work but the command-control-onkey "reboot switch"
will.  The onkey works and so does the command and cntrl keys (both of them)
separately.  The cmd-onkey just doesn't do anything.  I think it used
to work once before.  The computer system is almost new.  I have tried with
different software and with just system tools disk with and without 
macsBug (latest version).  ???

3.  I have a cutting edge 45+ hard drive.  Norton Utilities verifies
all of the media but when it tries toi optimize says that the disk has
one soft and one bad sector and that i should reformat.  The cutting edge
utilities test didn't see anything wrong with the sectors, but I reformated
anyway but the problem is still not fixed.  The only other thing I noticed 
about weird things happening on it is that once the directory data got
screwed up and it said 45 mb full, 65 mb available!!  Is norton at
fault here, or is it really my hard drive?

--erling mork
  university of oslo