achowe@tiger.waterloo.edu (CrackerJack) (04/23/89)
I have the Developer's Kit and the book << Programmer's Guide to GEM >> but neither can enlighten me on how to do the following: 1) How do I get the address of a string contained in a dialog in order to change its contents? What I'm doing is: : rsrc_gaddr( R_STRING, STR_OBJ, &string ); sprintf( string, "%4d", value ); : 2) How do I send myself a WM_REDRAW message? What I'm doing is: SendRedraw( tree, obj ) long tree; int obj; { int msg[8]; ObjcXywh( tree, obj, &msg[4] ); msg[0] = WM_REDRAW; msg[3] = GemHandle; appl_write( ApplHandle, 16, msg ); }/* SendRedraw */ someroutine() { : /* dirty screen, change string values in object */ : SendRedraw( TreeObj, ROOT ); } Is any of this right? - Ant achowe@tiger.waterloo.edu | "Murdered by pirates is good." __ _ | - The Princess Bride (movie) / _ _ _ |/ _ _ | _ _ |/ | \__| `<_\<_ |\|= | ` \_/<_\<_ |\ | disclaimer...
kbad@atari.UUCP (Ken Badertscher) (04/24/89)
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>
uace0@uhnix2.uh.edu (Michael B. Vederman) (04/25/89)
Is it my imagination, or is rsrc_gaddr really only useful for getting the address of a tree in a resource. In other words, one can not really get the address of an object in a resource, unless the resource only has one tree. - mike -- for (;;) : Use ATARINET, send an interactive do_it(c_programmers); : message such as: : Tell UH-INFO at UHUPVM1 ATARINET HELP University Atari Computer Enthusiasts : University of Houston UACE