Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6002237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:56:57+00:00 2026-05-23T00:56:57+00:00

——— Question 1 ———- Maybe I don’t understand the frame object completely (or maybe

  • 0

——— Question 1 ———-
Maybe I don’t understand the frame object completely (or maybe it wasn’t created correctly in my context), but as I was trying to implement a mouse event I encountered the situation where the call:

trackingArea=[ [NSTrackingArea alloc] initWithRect:[self frame] options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveInKeyWindow) owner:self userInfo:nil ];

Resulted in incorrect tracking area (only top right corner worked) – looking into the problem I found that ‘frame’ started somewhere in top right corner. This call was made in an overloaded initWithFrame defined as:

glView = [ [ Lesson17View alloc ] initWithFrame:[ glWindow frame ]
colorBits:16 depthBits:16 fullscreen:FALSE ];

where glView is subclassed from NSOpenGLView. The above call is made in awakeFromNib, and glWindow is defined as:

IBOutlet NSWindow *glWindow;

When I replace bounds with frame, my application works – what is going on with the frame variable?

——— Question 2 ———-

My second question involves how to handle the mouse events and correctly have my openGL view redraw – say I have:

- (void) mouseMoved:(NSEvent *)theEvent
{
NSPoint location=[self convertPoint:[theEvent locationInWindow] fromView:nil];
// send NSPoint to a printGL function I have that uses texture maps to display text?
}

I’m guessing I shouldn’t be sending this to a function that renders something in my openGL view (because this doesn’t do anything -guessing because whenever I use drawRect whatever I drew during the mouse event is cleared). Currently all my drawing is perfomed in drawRect (contains a bunch of openGL calls) – what would be the appropriate call to make at this point?

Or should I set a flag (along with setting an instance variable NSPoint) to true that will allow printGL to be called only on mouseMoved events (I know – I’ll use the mouseEntered/Exited functions but for now I’m trying to get a handle on this).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:56:58+00:00Added an answer on May 23, 2026 at 12:56 am

    A view’s frame is where the view is located in its superview. This means most importantly that unless the view’s origin is right on top of its superview’s origin (i.e. at {0, 0}), the frame rectangle will be offset by that amount.

    A view’s bounds are the coordinates inside the view. Unless you’ve applied some transform to the view’s coordinate system, the bounds origin will always be at {0, 0}.

    So, why does this make a difference in your case? As noted in the docs for NSTrackingArea, the rect is interpreted as coordinates in the coordinate system of the tracking area’s owner. The owner’s bounds are in its coordinate system, while the frame is in coordinate system of the owner’s superview. So you’re giving the tracking area a rect from the wrong coordinate system.

    I highly recommend reading the View Programming Guide. It explains all of this and more. There are a lot of subtle details to the Cocoa view system that you’ll want to know when you’re writing UI code.

    (And for your second question: To tell a view to redraw, send it [view setNeedsDisplay:YES].)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've decided to take the advice in this question: create-excel-chart-programmatically-in-php and NOT attempt to
This is a follow-up to the question: Should the folders in a solution match
I'm trying to write a web application using the new offline capabilities of HTML5.
I recently ran against a very interesting site that expresses a very interesting idea
I am currently running into a problem where an element is coming back from
By fixed vector I mean a static list of values, like 1 through 24.
I'm including a local class that requests a file from a remote server. This
I'm using some of Firefox's specially-defined values for cursor, in particular -moz-zoom-in -moz-zoom-out -moz-grab
My app uses a WebRequest at certain points to get pages from itself. This
I've got a typical impedance mismatch where the data is stored in a normalized

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.