[comp.sys.amiga] help: window IDCMP flags

jan@oscvax.UUCP (Jan Sven Trabandt) (02/21/88)

Howdy howdy.

I have a few questions pertaining to windows, IDCMP flags and gadgets.
All the following questions pertain to SMART_REFRESH windows.

1 - I thought I once saw a way to set the flags so that you only get
    REFRESHWINDOW events when the window is enlarged (ie not smaller)
    but I can't figure it out so I filter them myself.

2 - It looks like doing a RefreshGadgets() causes a REFRESHWINDOW event
    (if that flag is set in the IDCMP). Is that really so??

3 - I have a window with several custom gadgets (scroll bars)
    as well as the system close, drag, depth and resize gadgets.
    My IDCMP flags are: CLOSEWINDOW | GADGETUP | GADGETDOWN
			| NEWSIZE | ACTIVEWINDOW
    When I get an ACTIVEWINDOW event I do a SetWindowTitles().
    When I get a GADGETUP I might do a RefreshGadgets().
    When I get a NEWSIZE event I do a ModifyProp(), RefreshGadgets(),
    SetWindowTitles(), SetRast() [on the window], and PrintIText() 
    some data into the window
    [though not in that order].
    What seems weird to me is that *after* I resize the window once,
    dragging the window or clicking the menu-button [either in my
    window or in the screen/backdrop window] causes my window's
    gadgets to be refreshed by the system (which it didn't cause prior
    to the resizing).
    Any ideas on what is causing this nuisance??

Thanks in advance,
Jan Sven
--------------------------------------------------------
"Violence is the last resort of the incompetent"
	- Hari Seldon, 'The Foundation Trilogy'  (Isaac Asimov)

Mind like parachute  -  function only when open!

Jan  (Jan, from Amsterdam) no-hyphen Sven  Trabandt
...!{allegro,ihnp4,decvax,pyramid}!utzoo!oscvax!jan

dillon@CORY.BERKELEY.EDU (Matt Dillon) (02/22/88)

:
:Howdy howdy.
:
:I have a few questions pertaining to windows, IDCMP flags and gadgets.
:All the following questions pertain to SMART_REFRESH windows.
:
:1 - I thought I once saw a way to set the flags so that you only get
:    REFRESHWINDOW events when the window is enlarged (ie not smaller)
:    but I can't figure it out so I filter them myself.
:
:2 - It looks like doing a RefreshGadgets() causes a REFRESHWINDOW event
:    (if that flag is set in the IDCMP). Is that really so??

	SMART_REFRESH windows get REFRESHWINDOW events.  Usually, I
just add NOCAREREFRESH to NewWindow.Flags.  If you do not, you *must*
handle the event.

	Use the NEWSIZE IDCMP to handle being informed when the window
is resized.

:
:3 - I have a window with several custom gadgets (scroll bars)
:    as well as the system close, drag, depth and resize gadgets.
:    My IDCMP flags are: CLOSEWINDOW | GADGETUP | GADGETDOWN
:			| NEWSIZE | ACTIVEWINDOW
:...
:    window or in the screen/backdrop window] causes my window's
:    gadgets to be refreshed by the system (which it didn't cause prior
:    to the resizing).
:    Any ideas on what is causing this nuisance??
:
:Thanks in advance,
:Jan Sven

	Because you are not handling the refresh message, and they stack
up.  It doesn't matter that you do not specify it in the IDCMP.

Solution:	Set NOCAREREFRESH in your window's flags (i.e. in the 
		NewWindow structure).

				-Matt

bryce@eris (Bryce Nesbitt) (02/22/88)

In article <584@oscvax.UUCP> jan@oscvax.UUCP (Jan Sven Trabandt) writes:
>
>All the following questions pertain to SMART_REFRESH windows...
>
>    What seems weird to me is that *after* I resize the window once,
>    dragging the window or clicking the menu-button [either in my
>    window or in the screen/backdrop window] causes my window's
>    gadgets to be refreshed by the system...

If you don't handle REFRESH events, you MUST set the NOCAREREFRESH
flag when opening the window.

If you do handle REFRESH events, you must call the Begin/EndRefresh() 
pair to clear the state after each refresh event.  It is best to call
BeginRefresh(), render your window, EndRefresh().


The reason for this is Intuition.  It wants to maintain the borders
of your window in nice condition at all times... even if your task is
asleep.  It needs to know when you have fixed up your window so it
can stop refreshing the borders for you.

See the first Amiga Transactor for a this and other such hints.

You are correct on all other points.

|\_/|  . ACK!, NAK!, EOT!, SOH!
{o o} .     Bryce Nesbitt
 (")        BIX: mleeds (temporarily)
  U	    USENET: bryce@eris.berkeley.EDU -or- ucbvax!eris!bryce