Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

Archive for January, 2013

getting desktop printer information in Classic environment

We do a bit of automated document production around here, so we have
some code that gets the current desktop printer, sets the current
desktop printer to a Postscript writer, prints something, and sets it
back.

I’ve noticed that Gestalt( gestaltDTPInfo, … ) is returning
gestaltUndefSelectorErr when running in the Classic environment,
though it returns a valid result in Mac OS 9.  If I can’t use
gestaltDTPInfo, how am I supposed to get information about desktop
printers?

- Dave

.
posted by admin in Uncategorized and have Comment (1)

Xcode extensibility?

Can Xcode be extended to work with other programming languages such
as Python?  Or for that matter, can AppleScript Studio (which I have
not looked at yet)?

From what I have seen so far, Xcode simply generates code and other
files for building a project and creating an application bundle.  GCC
and GDB are backends.  Python (Ruby, Perl, etc) can easily have
Carbon modules made (if they don’t already) and perhaps even Cocoa
bridges.  It would be nice to have additional language choices
without having to just do it all with Emacs and command line tools.


   One Emacs to rule them all.  One Emacs to find them,
   One Emacs to take commands and to the keystrokes bind them,

All other programming languages wish they were Lisp.

posted by admin in Uncategorized and have Comments (6)

continious spell check

how would i enable continious spellcheck (red lines) by default in a nstextview?
i know of the option in edit->spell check
and  at the moment link in interface builder, a a buttion to the action in
Frist responder.

anyone know how to i do this in code ie when the window opens,

thanks,
-Anu


=================
Anurodh Pokharel
anuro…@SPAM.users.sf.net

http://osxnews.sf.net

posted by admin in Uncategorized and have No Comments

Thread-safe array access in Carbon?

I’m working on an application for doing USB I/O.

The main problem I’m having right now is that there’s an input buffer
that’s being written to asynchronously by a callback routine whenever
USB input is being detected (ReadPipeAsync()).

I’m also trying to read the contents of this input buffer and copy it
into a string or other array for use after input is detected.

I’m running into problems where the callback routine is trying to write
to the array at the same time as another method is trying to read it
causing an access fault.

I know how to fix this type of competition in Java by using the keyword
"synchronized" on the methods which read and write the array, but I’m
not sure how to make this type of thing work in Carbon, nor how to pause
a thread and say "wait here until the other method is done".

Can anyone either explain it to me or point me at a resource which
explains it?

Many thanks.

CT

posted by admin in Uncategorized and have Comments (6)

NStoolbar icons

are there any other icons provided by apple other than the
4 (print, config, font and color) ?

i know i can use my own tif files, but  does apple have any
that they provide for UI consistency ?

-Anu


=================
Anurodh Pokharel
anuro…@SPAM.users.sf.net

http://osxnews.sf.net

posted by admin in Uncategorized and have Comments (2)

Re: Multiple Questions Involving X-Code

In article <210120041941502848%nob…@diespammerdie.com>,
 John Doe <nob…@diespammerdie.com> wrote:

> Also, what free ways are there to develop Carbon CFM apps that can run
> in classic?

MPW in Classic is the only way to do this for free.  Most people use
CodeWarrior to build Classic apps.

> Those apps can’t use nibs either, right?

Nibs are supported in Carbon, at least back to Mac OS 8.6.  They work in
both Mach-O (which is Mac OS X-only) and CFM (Mac OS 7/8/9 and Mac OS X).

Hope this helps,
Eric


Eric Albert         ejalb…@cs.stanford.edu
http://rescomp.stanford.edu/~ejalbert/

posted by admin in Uncategorized and have Comments (8)

Cocoa, Object Id, encoding – decoding.

Hello NG,

i think that is a typical beginners question. I want to store something like
a b-tree in to a file.
At the moment i have a object, witch stores the a pointer to the id of the
next object in a instance variable.
Is there a way to store the tree so, that i don’t have to rebuild the tree
( assigning the new object id’s) after decoding the objects from file ?

Thank you for your time an help

posted by admin in Uncategorized and have Comments (9)

Where to get the AddressBook data back from after iSync trashed it ???

Hi,

since my iSync happily trashed some important entries (dunno whom to
blame now), I am very urgently looking for some help on the matter.

The only thing I found, which _might_ still contain the old data is
located at:

/Library/Application\ Support/SyncService/505/EngineData/Data/ …

I do not, however know if there is any chance of using those files or
extracting the data from them??? Also if anybody knows other way of
getting the data back?

The *.previous are invalid too… :-(

Help on the matter would be highly appreciated!

posted by admin in Uncategorized and have Comments (2)

Writable volume attributes

I have to create a number of cache folders, and naturally I want to put
them into the Temp or Chewables folder. These will potentially be big
caches, so I want to give the user the ability to prefer a volume, a la
Photoshop.

I was planning to simply search for local, unlocked volumes, and
present these to the user, but after looking at MoreFilesX, csmp, and
so forth, it appears there are some new wrinkles involving CDs,
permissions, and drop boxes, and all sorts of fun things that have been
introduced as of late.

I can figure out the "hows" from the available sources, but I’m not too
sure on the "whats".  If anyone with volume-savvyness can add things to
look for to the following list, I’d be most grateful…

local
writable
not locked
not a CD
not a DVD
Find Folder can find a Temp Folder or Chewable Items Folder

…..?


remove the obvious to reply by email

posted by admin in Uncategorized and have No Comments

Creating an 'xmnu' resource?

Trying to get menus working in Carbon is an enormous pain in the ass,
and Apple’s website is much less than helpful.  I’m attaching some
problematic sample code.

Despite calling SetMenuItemCommandID() on my menu items, I’m still not
getting the proper HICommand.commandID variable returned by
GetEventParameter().

I think perhaps the problems I’m seeing are due to the fact that my
"MENU" resources don’t have ‘xmnu’ resources associated with them.  

How do I go about creating an ‘xmnu’ resource?  ResEdit is no help.  I’m
using Codewarrior.

I tried to create a text file, but I keep getting errors that say
"unable to open file "Types.r".

Thanks.  Sample code follows:

   file_menu = GetMenu(FILE_MENU_ID);
   err = SetMenuItemCommandID (file_menu, (SInt16)QUIT_ITEM,
kHICommandQuit);

pascal  OSStatus handle_command_event(EventHandlerCallRef
inHandlerCallRef, EventRef inEvent, void *inUserData)
{
   OSStatus    result = noErr;
   HICommand   command_object;

   #pragma unused(inHandlerCallRef, inUserData)

   //***** Find out what kind of command event it was
   result = GetEventParameter (inEvent,
                        kEventParamDirectObject,
                        typeHICommand,
                        NULL,
                        sizeof(HICommand),
                        NULL,
                        &command_object);

   //***** See if the command was from a menu
   if ((command_object.attributes & kHICommandFromMenu)  != 0)
   {  
      switch (command_object.command_id)
      {
        case kHICommandQuit:
           handle_file_menu();// this never gets called when ‘quit’ is
                              //selected
            break;
      }
   }

   return(result);

- — -

} // end of handle_command_event()

posted by admin in Uncategorized and have Comments (4)