America Online APPLE II DEVELOPMENT FORUM CONFERENCE LOG Tuesday, November 17, 1992 10:00 p.m. Eastern Time Topic: Resource Programming Forum Leader: Gary Jacobson (AFL GaryJ) AFL GaryJ Welcome to the Apple II Development Forum! AFL GaryJ Tonight, our topic is Programming with Resources! AFL GaryJ We won't use protocol, at least not unless things get too rowdy. AFL GaryJ If anyone has a question or comment about resources that they'd like to AFL GaryJ start off with this evening, please jump in. AFA Jay I have a question :) AFL GaryJ Go ahead, Jay :) AFA Jay Ok, this is a non-resource resource question ;) AFA Jay I have an rTextForLETextBox2... AFA Jay Says here that if you use a C you can change the foreground color... AFA Jay it says the data size is a word and it's the "Color of foreground, as an index AFA Jay into the current color table" == WHAT? :) Sheppy 0=black...F=white, isn't it, using normal color table? AFA Jay Well, I found out you need things like aaaa, bbbb, 3333, 1111 to get something AFA Jay that looks normal... AFA Jay but even then, the colors don't match any chart I have in any book :) Matt DTS OK, I give up. What _are_ you talking about? Sheppy Oh...hmmm... that sounds familiar, somehow. JWankerl Looks like a dithered pattern to me. Spottysoft (better run it by Matt again Jay... :) AFA Jay LETextBox2's, Matt.. AFA Jay the C foreground color parameter :) AFA Jay it says index into the current color table is the parameter for the foreground AFA Jay color. Sheppy It is. I've had to do that, too - use a dithered pattern word to get the Sheppy background to come out right. Sheppy Otherwise I get nasty vertical stripes of, like, black and white. Sheppy (in rTextForLETextBox2 resources) AFA Jay RIGHT! AFA Jay the stripes! :) Matt DTS Yeah, ask Dave. He's got the source handy; I don't. AFA Jay Ok, one more time :) Spottysoft (from the top.. :) M Wolfgram that's two Sheppy [everything Jay says is the absolute truth - I swear it] AFA Jay LETextBox2's....C Foreground color embedded command... AFA Jay takes a word parameter, the description says "Color of foreground, as an index AFA Jay into the current color table" AFA Jay if I put in 000F I get stripes... AFA Jay I've found you need aaaa, or 1111 or all the same... AFA Jay BUT! the colors don't match any tables I've seen... AFA Jay they're the standard colors, but they don't match the numbers :) AFA Jay I'm confused :) Dave Lyons I just looked at the source, and it's just calling SetForeColor with whatever number you give it. Dave Lyons What port are you drawing in? It matters whether the FontFlags bit 2 is set or not (in AlertWindow, Dave Lyons it's set only if you set a special flag bit). Sheppy That's odd. This happens for me, too, sometimes. Sheppy What does bit 2 have to do with the background pattern being wrong? I'm lost.. Dave Lyons Anyway, if that bit is set, you need $1111, $2222, etc. If not, just $000x should be fine. AFC DYAJim (sorry.. important incoming call :) Dave Lyons Sheppy, If FontFlags bit 2 is set and you use $000x, you get a striped pattern...3 columns of Dave Lyons black and one of color x. The bit means "use all 16 bits of the color." Sheppy Ah. I just don't see... oh, okay, right. The background is a text background, Sheppy so it makes sense for "font flags" to be involved. Okay, gotcha. Dave Lyons AlertWindow should be setting FontFlags bit 2 if and only if you set a special 6.0 flag bit (in Dave Lyons the AlertWindow call) asking it to. (During 6.0 development, there were some versions that always Dave Lyons set it, but we found that really screwed up some people's existing alerts!) AFA Jay Ok...Ok, I got it, ok :) AFL GaryJ :) AFL GaryJ Any followup, Jay, or does that do it? AFA Jay Nope, I get it...:) AFL GaryJ Ok... AFL GaryJ Thanks for the question, Jay, and the answers, Matt and Dave :) AFL GaryJ Is anyone here doing anything resourcful? Sheppy Nope. It makes life so wonderful that I have very few problems with it... AFC DYAJim (I want to see some way to get the rfileID of an already open rfile!:) Sheppy Yes! I agree 1000%, Jim!! AFC DYAJim (like let OpenResourceFile pass back the rfileID along with an error that AFC DYAJim it's already open) Sheppy Yes, yes, yes... :) AFL GaryJ (1000%?? :) Sheppy Okay, Gary. You got me. I _meant_ 10,000%. :) M Wolfgram ! AFL GaryJ Go ahead, Marc M Wolfgram There's a problem with that... M Wolfgram A file can be open multiple times for one... like Sys.Resources AFC DYAJim I can't get any of my files to be opened multiple times.. AFC DYAJim (they all say already open) M Wolfgram Also, what guarantee do you have that a rFileID isn't busy with another app? Sheppy If it's read/write, you can't open 'em repeatedly. JWankerl You can't open them read only multiple times? Sheppy Obviously, it would be used only in special circumstances. It would still Sheppy return an error... Dave Lyons Yup, multiple read-only works fine. M Wolfgram Yes... read only AFC DYAJim Oh, r/w.. well why can't it pass back the rfile id if it's r/w? Sheppy Read only can be opened repeatedly, no sweat. Sheppy Or at _least_ a special call for it, because there _are_ circumstances where Sheppy it would be very useful (or necessary) to have that ability. Sheppy Eg: an application with modules that only minimally communicate with each Sheppy other. They need access to the same config. file, but can't have it because Sheppy they can't each open the file. For example. Dave Lyons Jim, do you mean if it's already open within the same resource app, or in general? AFC DYAJim I mean with the same app M Wolfgram Can't the app pass the resfileid to the module through iac or something? Sheppy (I'm contemplating an app. with that same problem). Sheppy But if they have different resAppIDs, you get errors trying to access the Sheppy file. That's the problem. AFC DYAJim Yes, but I don't see why openresourcefile can't just pass it back in the result AFC DYAJim along with a file already open error, not opening it again. Dave Lyons Jim, having multiple users of the same resource map would introduce some problems unless they were all Dave Lyons cooperating very carefully. For example, it's perfectly legal to load a resource, modify it Dave Lyons in memory, *never* mark it changed, and have it never written back out to disk. -- If somebody Dave Lyons else was using the same file r/w through the same map, they might make another change to an already- Dave Lyons loaded resource, mark it changed, and accidentally capture the previous change. It would change Dave Lyons the rules. JWankerl You could call GetRefNum of the open file pathname and pass the result to GetOpenFileRefNum JWankerl to get your opened file resource ID. AFC DYAJim Dave - the program that needs to get the rfile id is not modifying the AFC DYAJim resources. It is using it as if it was only open read only. Sheppy Joe: GetOpenFileRefNum takes a resFileID, and returns a refNum. :) JWankerl Oops. :-) AFC DYAJim The code that already knows the rfileid (since it opened it :) is the code AFC DYAJim that actually writes to the rfile. The code that doesn't know the id is just AFC DYAJim reading the rfile. Sheppy The concept is that an application itself wants this information for other Sheppy parts of itself to have. AFC DYAJim But I can conceivably think that all changed resources should be Updated AFC DYAJim before trying to reread them. M Wolfgram Scary stuff, Jim... pass the info then... not access to the file. JWankerl I guess you could look in the Resource Manager's WAP to find the info, then. :-) Sheppy [heck, even a legal way to steal it from the system would be okay for me :)] Dave Lyons Okay. Well, it sounds like you'll have to either do some inter-module communication with SendRequest, Dave Lyons or arrange something similar, such as the correct resource file being the CurResourceFile when a Dave Lyons module first gets control (that's a perfectly good way to communicate the info to the module). ga Sheppy IPC is what I've been thinking, but it doesn't work very well for this (I Sheppy know from experience, eh, Jim :) AFC DYAJim It does too! :) you pass the rfile id, not the rapp! :) AFC DYAJim (Yes, there's a t2ShareWord external ipc request that I implemented for this, AFC DYAJim but I was wondering if/why the system could[n't] do it) Sheppy Sigh. Doesn't work when I try it. I have to do nasty, sneaky things that Sheppy aren't probably totally legit. Bleah. :( AFC DYAJim It WORKS. I've done it with NL a thousand times. You shouldn't be doing what AFC DYAJim you're doing :) Sheppy I get "nonexistent resource file" type errors. Sheppy Heh. When I try it in NL, it fails, Jim. :) AFC DYAJim Why don't you send me a version that produces the errors? (that is when my GS AFC DYAJim gets fixed) Sheppy Okay. AFC DYAJim and I"ll step thru it and see too. AFC DYAJim put some brks in it around the code that I should watch for : Sheppy But I'll have to rewrite some code to put them back in. :) AFC DYAJim well take your time as I won't have a working Gs until at least probably a AFC DYAJim week. Sheppy [heh. believe it or not, writing T2 modules really _is_ fun! :) ] AFL GaryJ Let's all fix Jim's GS. Dave Lyons No questions? Hmmm...anybody wanna buy a used Mac IIx? AFA Jay NO :) AFC DYAJim Alltech thinks that the '816 socket might have gotten fried.. so I'm gonna send AFC DYAJim it to them to take a look. Dave Lyons :-) AFL GaryJ :) AFC DYAJim IIx.. not portable enough for what I'm possibly looking for :) Sheppy I'll give you $5.95 for it, Dave. The wind keeps blowing our door shut. :) Dave Lyons (It's not *that* used. :-) AFA Andy Sheppy. I'd give $6.00. ;) Sheppy Bwahahahahaha! :) $6.50. Not a penny more. :) WinkieJim What's wrong with it? AFA Andy I wouldn't go that high. AFA Jay Oh, c'mon, I'd give 10 just for the scrap plastic :) AFL GaryJ Do we hear $7.00? AFC DYAJim I'll offer $6.75 AFL GaryJ I could use the power supply, probably. AFA Jay You could probably melt it down and get some gold outta it too :) Dave Lyons Now I know why I never see people trying to sell stuff here.... :) AFA Andy LOL Jay :D AFL GaryJ I need to replace the power supply in one of my external HD's. Sheppy $6.80. AFL GaryJ Does it come with a monitor? That might be worth something. I'll offer $10. AFA Jay 10.01 :) AFL GaryJ :) AFC DYAJim alright, $20 M Wolfgram (And the score is: Resources 1, Mac IIx 1) AFL GaryJ Gee, are we resourceful tonight, or what? :D AFA Jay WOAH, can't top that! Sheppy Ooooh! A bidding war! AFL GaryJ Out of my range already, too :) Sheppy $155,093.39 <--- That's what my IIgs is going for. Takers? >:} AFA Jay yah, sure :) AFL GaryJ Must be a Woz edition? :) WinkieJim $6.99 Sheppy I'll even throw in a joystick. AFL GaryJ Woz came and spoke at our users group meeting, shortly after the IIGS was introduced. AFL GaryJ People brought 3.5 drives and all kinds of hardware for him to sign with AFL GaryJ a permanant marker :) AFA Andy :) AFL GaryJ I didn't think of doing such a thing, myself, or otherwise I'd have AFL GaryJ a Woz edition 3.5 drive :) Sheppy That would be cool, huh? Wow... AFL GaryJ Yeah, wow. Sheppy Then laminate the drive. Cool! AFL GaryJ Well, the price might top your $155,093.39 IIGS :) Sheppy Pound it flat with a hammer and keep it in my wallet between the picture of Sheppy my parents and my credit card. :) Sheppy lol, Gary! AFL GaryJ How is Foundation doing? M Wolfgram Well! We are now in the final run at getting ScriptEdit completed! Sheppy ** cheer, applaud ** Sheppy Gimme, gimme, gimme (when done, of course) :) M Wolfgram Applaud Jim. Sheppy <--- kneeling before Jim. :) Jim Murphy :-) Sheppy Does it sing and dance, Marc? Jim? M Wolfgram He's done an incredible job on something that got more complex the closer it got to completion. AFL GaryJ Does anyone here use Design Master still? Sheppy Oh, God, don't remind me that I was lame enough to buy that thing... :( AFL GaryJ Or, has everyone switched to Genesys? :) M Wolfgram Gary! Sheppy Even without the native editors, Foundation kicks DM's butt. AFC DYAJim (Quick vote: would you rather see "update" or "save" to update the T2 AFC DYAJim preferences? Gshk uses update, so I did too) Jim Murphy "Write". :-) AFA Jay remember :) Matt DTS Save. AFL GaryJ "save preferences" AFC DYAJim not enough room, Gary AFL GaryJ :) AFC DYAJim and preferences is too complex a word :) AFC DYAJim "setup" :) AFL GaryJ I like "save", then. Sheppy "Save the preferences to the "Twilight.Setup" file on your boot volume" :) Sheppy Save works for me. Either or. I ignore it anyway. :) Sheppy (the text in the button, not the program) AFL GaryJ "Update" sounds like the version number should increment each time you perform the AFL GaryJ opperation. AFL GaryJ (version number of the program, that is) Dave Lyons (I vote Save.) Sheppy "Nuke" would be fun. AFL GaryJ :) AFL GaryJ Hi Tim AFA Andy Hey Tim! Sheppy Although floating names would be entertaining. "Save" "Write" "Memorize"... AFC DYAJim Guess I'll have to change it when I get going again :) Sheppy ya know. :) AFC DYAJim hey Tim Sheppy Tim! GNO Tim2 howdy Sheppy Welcome to our humble gathering... :) AFL GaryJ Nothing like confusing the user :) AFL GaryJ (Have a "randomize menu bar" feature :) Sheppy Reminds me of a game I was doing once. To heighten the suspense, menu items Sheppy and stuff would eventually move around or totally disappear. :) Sheppy (obviously, that would be the main purpose of the items... :) AFL GaryJ Yes, but is "suspense" a good word? How about anxiety? (Like when the user Sheppy Hmmm... worked on planning that one while on BART going to and leaving the Sheppy '88 AppleFest in SF. :) AFL GaryJ finds that the "quit" menu item is no longer available :) Sheppy Oh, well. I like a captive audience. :} AFC DYAJim I saw a review of a mac program that showed a picture with like 12 hierarchical AFC DYAJim menus overlapping each other. they overlapped all the way to the right of the AFC DYAJim screen, then back to the left, then back to the right again, and maybe more :) Sheppy Aiiiiiiigggghhhhh! Bleah! But I like heirarchical menus. I'd kill for AFL GaryJ Yow. That's a bit much, don't you think? :) Sheppy source to make some in my programs. :) Matt DTS Jim: Not unless they used custom menus, which I doubt for hierarchicals. :) Sheppy (or maybe just ask politely... killing is dirty work) AFL GaryJ Disassemble WordPerfect GS. Sheppy Uh... never even seen it. AFC DYAJim I have the hierarchical source, Gary. AFC DYAJim Why bother disassembling it :) too much effort AFA Andy Kangaroo uses hierarical menus. AFC DYAJim I have yet to see kangaroo to comment. but so far I haven't liked any of the Sheppy Yes. That's what got me interested in doing them in my own programs on the GS. AFC DYAJim implementations of hierarchical menus on the GS (namely, WordPerfect and Jonah AFC DYAJim Stich's) AFL GaryJ I'm gonna see Kangaroo this weekend. (A demo of it) AFC DYAJim Eventually when I have some time I will modify Jonah's to address all my AFC DYAJim gripes, and then I might start using it in programs. But that's a ways off. Sheppy The photos of Kangaroo look like real Mac-style heirarchicals. AFA Andy But Heiraric was written so other programs can use it. Sheppy (as far as you can tell in those little things) AFA Andy But it might just be 7 hills programs. :D Matt DTS Oh, BTW, I was talking about the Mac program. It didn't have more than 5 levels of hierarchicals... Matt DTS ...because that's all the standard MDEF on the Macintosh supports. Any more and it wasn't any easier Matt DTS than doing it on the IIgs. AFL GaryJ Hierarchicals can go overboard, in my opinion. AFC DYAJim that's odd matt, it did have more than 5. I will have to find where I saw AFC DYAJim t and look in more depth. Sheppy I think having more than one (or two _max_) levels is tacky and poor Sheppy programming style. Even _I_ wouldn't abuse the HIG like that. :) AFA Jay Ok, well, it's time :) M Wolfgram IMHO, Hierarchicals are really unfreindly things from a user's perspective. AFC DYAJim I found it! AFC DYAJim 10 levels! AFL GaryJ It's time? You mean, we had another wyrm? :) AFC DYAJim (10 popouts that is, 11 if you count the original menu) AFL GaryJ I agree, Marc. They "look" neat, but they get tiresome, after using them AFL GaryJ over and over. Matt DTS Marc: But it makes things a lot easier for programmers, which is why fighting them is a Matt DTS losing battle. AFA Andy They are hard to use Marc. AFC DYAJim "Power Menus 1.0".. "an unlimited number of submenus is a lot more than any AFC DYAJim sane person would like to see." AFC DYAJim crazy Sheppy Nuts. Sheppy Just plain loony. GNO Tim2 Actually, they're quite easy to use if done properly GNO Tim2 Much faster then getting a dialog box, selecting, then clicking OK M Wolfgram It's settled then... write programs for programmers with one vertical menu and popouts for the subs :) Sheppy I like 'em for some things, myself. Like fonts & styles & sizes and such... AFC DYAJim I like them for the finder's extras menu Matt DTS Tim: No, they're not. User studies prove this. Sheppy That would be a cool place for this, IMO... extras menu. But that's me.