CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    3

    fixed modal dialog

    Hi to everyone,



    i am writing an awt applet. When someone clicks on a button a confirmation "yes/no" dialog pops up. When the user drags (moves) the dialog from its title bar and drops it inside the drawing panel (which contains drawings i.e circles,ovals,lines etc.) , the panel contents are erased (destroyed).
    Does anyone know how can I make this dialog fixed so that the user couldn't move it?
    Or if that isn't possible, is there a way to protect my panel's drawings (lines, circles etc) from being lost when the dialog lies inside the panel?

    thanks in advance
    thanasis

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: fixed modal dialog

    Dragging stuff over your drawing shouldn't delete anything... The drawing code should be in the paint(...) method of the panel so that it gets redrawn by the system every time it is necessary. The system will call the paint(...) method whenever part of the panel needs redrawing.

    Your applet should store everything that the panel's paint(...) method needs to redraw the picture. Have a browse through Methods For Drawing.

    Somtimes the simple stuff takes more work than you think...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: fixed modal dialog

    or, in other words; it sounds ike youre drawing on the graphics context directly, and when ANYTHING passes over that region, your drawing effort will be lost (the system will realise that the panel is dirty and needs re-drawing, so it invokes the paint() method, which you have not over-ridden; paint()'s default action is to paint the background, nothing else)

    dlordes suggestion of storing what you want to draw is a good idea; it sure makes saving it to disk more easy anyway.
    either, draw to an offscreen buffer, then use the paint() method to copy the data onto the screen, or insert objects into a storage container of some kind, like a Linked List.. you can store objects, points, lines, pictures, etc.. anything that can draw itself. iterating through the lsit from the start will redraw everything. this approach makes Undo an easy thing to implement, but refreshing the image takes longer as pixels may be painted several times
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured