Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Working With Bitmap Images; Document-Based Application Redux
Subject:   Making the view a dragging destination
Date:   2002-05-03 12:34:15
From:   michele
Response to: Making the view a dragging destination

Hello p,


"Evidentally, not all methods need be mentioned in the header file, rather these are only used in the name space of the implementation. What are such methods called? "


They are inherited, so you don't need to put them in the header file, but you can. Do what you feel.


"When I made a new window from the file menu item, it always came in with my default gif, Yoda.gif, but I could still drag another gif onto that window and Yoda would be supplanted. Does this cause memory leak or is the old image in ram automatically released?"


No, it's designed so that there is no memory leak. You can test it with ObjectAlloc (in Developper Applications). Launch ObjectAlloc, put a few breaks in strategic places in your code in PB, debug compile, open your debug built in Object Alloc and watch your own classes.


"initWithCoder evidenced itself as an override with the message to super and that fact that, though it was restricted to the name space of IAImageView.m, there was not visible call to it there. "


If you want to see when a part of your code is called, put a descriptive NSLog message in all methods so near as the beginning of the code as you can (I mean, after the variables), say NSLog(@"Enter mymethod"); Then debug run. You'll have a trace of all calls: yours and the underlying ones.


"To be contrary, I tried dragging Dennis Gabor's nobel lecture pdf to the window and got the first page complete with figure, but I didn't get the "whole picture" (35 pages). "


I'm not sure, but I remember playing with Preview and Acrobat for pdfs. Try to change the application to open the pdf (either Acrobat or Preview). I know one of them gives you the whole file (just don't remember which one).


Drag and drop is explained in Programming Topics.


Michèle




Full Threads Oldest First

Showing messages 1 through 4 of 4.

  • is Programming Topics a pdf?
    2002-05-09 07:08:32  psheldon [View]

    Looked for it with Sherlock. There are many many pdf files. I recall something about ApKit from long ago where I started to read about model view controller but felt not wise enough to follow then. I might like to read such a text now.
  • both Acrobat and Preview show whole pdf
    2002-05-09 06:54:38  psheldon [View]

    The drag operation to your application only gets the first page into an image.
  • Making the view a dragging destination
    2002-05-05 21:49:21  dallasmac [View]


    I added the drag and drop code, but dragging an image only works after I have opened an image.

    Is there a way that the drag event work when the inital window appears.

    Thanks

    Steve
    • Making the view a dragging destination
      2002-05-06 13:19:45  michele [View]

      Basically no, because while dragging an image you put the data (raw, bitmap, etc..) in a NSImage which will be put in turn into an NSImageView.

      That's why you need an existing NSImage (even transparent one) to drag another into it. See the Composite Lab example in AppKit for more details.

      Michèle