lietb@killer.DALLAS.TX.US (Tjeng-Bo Lie) (06/09/89)
Two questions to the net... 1. In processing a modeless dialog, how do I get some of the fields to come up right-justified? I've tried setting the (*textH)->just to teJustRight upon entry to that field, and set the destRect to be the same as the viewRect, but still I have some problem in the insertion bar not updated correctly. I've also tried TEAutoView and TESelView, to no avail. HELP!!! 2. How do I get the name of the application running? I'm trying to save some default parms in my application's Data Fork, and I don't want to tell my user NOT to change the name of the application. I know I can get the current resource file's refnum by calling CurResFile(), but how do I get to open my application's Data Fork if I'm not sure of the name? advTHANKSance. -- ******************************************************************************* * Compu$erve: 76344,3361 * UUCP: killer!lietb * * Delphi: TBLie * USnail: P.O. Box 740483, Dallas, Tx 75374 * *******************************************************************************
earleh@eleazar.dartmouth.edu (Earle R. Horton) (06/09/89)
In article <8316@killer.DALLAS.TX.US> lietb@killer.DALLAS.TX.US (Tjeng-Bo Lie) writes: > >Two questions to the net... ... >2. How do I get the name of the application running? I'm trying to save > some default parms in my application's Data Fork... GetAppParms will get you the name, and a GetVol in your initialization code will get you the location of your application file. Unless these default parameters are read-only, however, this scheme will generate problems in some environments (e.g. file servers). Do not write to your open application file, either fork, from within the application. Use a separate configuration file if you must save information between invocations of your program. Earle R. Horton "People forget how fast you did a job, but they remember how well you did it." Salada Tag Lines
svc@well.UUCP (Leonard Rosenthol) (06/10/89)
In article <8316@killer.DALLAS.TX.US>, lietb@killer.DALLAS.TX.US (Tjeng-Bo Lie) writes: > > Two questions to the net... > > 1. In processing a modeless dialog, how do I get some of the fields to > come up right-justified? I've tried setting the (*textH)->just > to teJustRight upon entry to that field, and set the destRect to be > the same as the viewRect, but still I have some problem in the insertion > bar not updated correctly. I've also tried TEAutoView and TESelView, > to no avail. HELP!!! > Trying to muck with the TERec in this way simply won't work. The Dialog Manager goes to great lengths to MUNGE the TERec that it uses - it's enough that it lets us get access to it at all :-) There is a way to get SOME of your edit fields right justified (I assume you only want some and not all) and that is to use the 'ictb' resource. The 'ictb' is the 'Dialog Item Color Table' but in addition to letting you set the colors of any/all dialog items it also allows you to set the font/size/style and justification of any/all of the text items in the dialog - ONLY ONE PROBLEM - the ictb data structure is a BIG mess and there are neither any editors for it NOR ResEdit TMPL's. (ie you get to create it from scratch in hex). The ictb is describe in the dialog mgr. chapter of IM V. > 2. How do I get the name of the application running? I'm trying to save > some default parms in my application's Data Fork, and I don't want to tell > my user NOT to change the name of the application. I know I can get the > current resource file's refnum by calling CurResFile(), but how do I get > to open my application's Data Fork if I'm not sure of the name? > There is a low memory global called curApName ($910) which holds the name of the currently running application (if you call it from your appl, it will be your name). NOW for the comment - IT IS NOT A GOOD IDEA to save things into the application itself (either data or resource fork). This will cause problems on servers/shared applications, locked volumes (like CD-ROM's), etc. and if you need to store defaults or preferences Apple recommends using the System Folder (as you can get the WDRefNum from SysEnvirons) to place a file there. -- +--------------------------------------------------+ Leonard Rosenthol | GEnie : MACgician Lazerware, inc. | MacNet: MACgician UUCP: svc@well.UUCP | ALink : D0025