CompuServe Thread

#Locating Dialogs

9 messages in this thread
#144921From: Alfonso HermidaJan 4, 1995 6:07 AM
Does anyone know how to create an IPAS4 function to position a dialog anywhere on the screen? I'm looking for something similar to center_dialog() but with some added functionality like: put_dialog_at(x,y) where x,y is the new location of the dialog box. Alfonso P.S. I tried modifying the Dialog structure, but this didn't work.
#144933From: Jonas Ruikis [ADESK]Jan 4, 1995 8:11 AM
Hi Alfonso, << put_dialog_at(x,y) where x,y is the new location of the dialog box. >> I don't know of any uploaded code to do this. jonas[adesk]
#145005From: Mark YankeeJan 4, 1995 3:28 PM
Jonas, A while back I was talking to you about *not* having the dialog boxs centered with Keyscript. I think the "put_dialog_at(x,y)" would be a good thing to put on the IPAS5 wishlist. Mark
#145019From: Alfonso HermidaJan 4, 1995 4:59 PM
I agree. If you have viewports that need to be displayed at the same time as the dialog, a function such as put_dialog_at(x,y) is needed badly. Alfonso
#145051From: Jonas Ruikis [ADESK]Jan 4, 1995 7:55 PM
Hi Mark, << "put_dialog_at(x,y)" would be a good thing to put on the IPAS5 wishlist. >> got it.
#145067From: Alfonso HermidaJan 4, 1995 9:33 PM
Jonas: I developed this code to handle the dialog location. I have to thank Stefan Didak who gave me a hint on how to code it. // assumptions: // 1) Dialog was created with upper left corner at origin // 2) center of Dialog will be positioned to the right @ // X = MAXX + (MAXX-MAXY)/2 = MAXY/2 // Y = (MAXY – dialog[0].height)/2 // // If someone has the time and patience, please make this function more general // like locate_dialog_at(x,y) where x,y are the upper left corner coordinates of the // dialog. int MAXX, MAXY; // maximum coordinates in X and Y, GLOBAL VARIABLES!!! void Do_User_Interface(void) { ScrnInfo screen; init_dialog( maindlg, main_edit, NULL); ready_dialog ( maindlg, main_edit, NULL, main_feel, main_rad, NULL, NULL ); gfx_scrn_info(&screen); MAXX = screen.sc_width; MAXY = screen.sc_height; center_dialog( maindlg ); locate_dialog( maindlg ); gfx_clearscreen(); gfx_cblock(0,0,MAXX,MAXY,6); // fill whole screen draw_dialog( maindlg ); do_dialog ( maindlg, -1 ); gfx_redraw(); } // The code that does the trick! // by Alfonso Hermida void locate_dialog(Dialog *root) { int max, start=0, i; max = dlg_item_count(root,start); root[0].sx += MAXY/2; root[0].sy = (MAXY – root[0].height)/2; for(i=start;i<max;i++) { root[i].sx = root[i].x + root[0].sx; root[i].sy = root[i].y + root[0].sy; } } /* Alfonso */
#145075From: Jonas Ruikis [ADESK]Jan 4, 1995 10:28 PM
Thanks Alfonso! << cool post.. >> I'll use your post the next time someone asks this question. Thanks again.. jonas[adesk]
#145142From: Alfonso HermidaJan 5, 1995 11:29 AM
I forgot to explain what I use it for, so it will be easier to understand the code. If you have 4 viewports on the screen (screen dimensions are MAXX and MAXY) the area to your right which is empty has the dimensions (assume the viewports are square and of size MAXY/2,MAXY/2) horiz = MAXX-MAXY vert = MAXY The code that I sent you locates a dialog that is already centered so that the center of the dialog is on the center of the empty area (that which is not covered by the viewports). Does it make any sense????
#145157From: Jonas Ruikis [ADESK]Jan 5, 1995 12:22 PM
Hi Alfonso, << Does it make any sense???? >> sure it does..