Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Working With Bitmap Images; Document-Based Application Redux
Subject:   Adding loading an image at launch time
Date:   2002-04-27 17:03:17
From:   michele
With the aim of implementing drag and drop in the application, I've added the loading of an image at launch time.


Loading an image at launch time (another option is to run a modal panel to force opening a file).


1 - Make a tiff image. Add it to the project (with copy items ... if needed checked).


2 - Add a method to MyDocument.h to load the image


- (void) setActiveImage: (NSString *) aString;


3 - Implement the method in MyDocument.m


- (void) setActiveImage: (NSString *) aString
{
activeImage: [NSImage imageNamed: aString];
}


4 - Change the windowDidLoad method in IAWindowController.m


- (void) windowDidLoad
{
NSImage *image;
if ([[self document] activeImage] == nil)
{
[[self document] setActiveImage: @"lave"];
}
image = [[self document] activeImage];

[view setImage: image];
[self scaleImageTo: 1.0];
}


if the loaded image is named lave.tiff, just give the name without extension as parameter to setActiveImage.


Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Adding loading an image at launch time
    2002-05-02 12:56:07  psheldon [View]

    Recent file functionality in ImageApp. Where can I look to see the pathnames of the images I opened that supply this recent?

    Step 3 had colon instead of equal sign. When I corrected this typo, your work worked.

    In a folder I called thread, I both saved your notes html source from IE and pasted from the browser rendering. That way I invented a subcolumn organization for myself. If only I knew how to save all notes and columns and make them a "search network" for Help Viewer. Help Viewer does use html source sometimes obscured by folders only accessible by control mouseclick's "show contents".

    Thanks for your work.
    • Adding loading an image at launch time
      2002-05-03 12:13:44  michele [View]

      Hello p,

      You can write an AppleScript to do this, or transform the html source to pdf and then search the pdf.

      Michèle