🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #38187

Re: GEM AES/Resource Questions

#38187
From: Ken Badertscher
Date: Mon, 24 Apr 1989 05:32
68 lines
2846 bytes
In article <13423@watdragon.waterloo.edu> achowe@tiger.waterloo.edu (CrackerJack) writes:
| 1)	How do I get the address of a string contained in a dialog in order
| 	to change its contents?

	#include <gemdefs.h>	/* R_TREE define		*/
	#include <obdefs.h>	/* OBJECT, GRECT typedefs	*/

	OBJECT	*dial
	int	i;
	GRECT	rect;
	typedef struct _prect { int *x, *y, *w, *h; } PRECT;
	PRECT	rectptr = { &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h };
	:
	/* start up application, load resource, etc... */
	:
	/* get the address of the tree containing the dialog `DIALOG' */
		rsrc_gaddr( R_TREE, DIALOG, &dial );

	/* put the string in the dialog object `DIALSTR' */
		sprintf( (char *)dial[DIALSTR].ob_spec, "%4d", i );

	/* redraw the dialog */
		form_center( dial, rectptr );
		objc_draw( dial, 0, MAX_DEPTH, rect );
	:

Make sure that the string object in your resource has MORE than enough
space to handle any strings that you're going to stick into it.


| 2)	How do I send myself a WM_REDRAW message? 

From the code you included describing how you were sending yourself the
message, it appeared that you wanted to redraw the dialog when you
changed the string values.  It's much better to redraw the dial (as above)
when you change the value of any string-type object.  However, if you still
want to send yourself a redraw message, try the following...
(untested code off the top of my head):


	#include <gemdefs.h>	/* WM_REDRAW define	*/
	#include <obdefs.h>	/* GRECT typedef	*/
	extern int gl_apid;	/* this application's ID */

	SendRedraw( whandle, rect );
	int whandle;
	GRECT rect;
	{
		int msg[8];

		msg[0] = WM_REDRAW;	/* message type	*/
		msg[1] = gl_apid;	/* sender ID */
		msg[2] = 0;		/* buffer length (0 := 16 bytes) */
		msg[3] = whandle;	/* window to redraw */
		msg[4] = rect.g_x;	/* rectangle to redraw */
		msg[5] = rect.g_y;
		msg[6] = rect.g_w;
		msg[7] = rect.g_h;

		appl_write( gl_apid, 16, msg ); /* tell self to redraw */
	}

Then, when your application recieves the WM_REDRAW message, it can
do whatever redrawing needs to be done, based on the rectangle.
-- 
   |||   Ken Badertscher  (ames!atari!kbad)
   |||   Atari R&D System Software Engine
  / | \  #include <disclaimer>
Technical Details
Message-ID: <1461@atari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!mcnc!xanth!lll-winken!uunet!portal!atari!kbad
References: <13423@watdragon.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!mcnc!xanth!lll-winken!uunet!portal!atari!kbad
From: kbad@atari.UUCP (Ken Badertscher)
Newsgroups: comp.sys.atari.st
Subject: Re: GEM AES/Resource Questions
Summary: How to get the address of a string in a dialog and send a redraw msg
Keywords: AES, dialog, rsrc_gaddr
Message-ID: <1461@atari.UUCP>
Date: 24 Apr 89 05:32:58 GMT
References: <13423@watdragon.waterloo.edu>
Reply-To: kbad@atari.UUCP (Ken Badertscher)
Distribution: na
Organization: Atari Corp., Sunnyvale, CA
Lines: 68