rwm@atronx.OCUnix.On.Ca (Russell McOrmond) (03/07/91)
Hi, I'm running with SAS 5.10 and on an A3000 machine. I have been trying to figure out how to open a window that allows me to snip out of it. I was talking to a friend that mentioned that all I had to do was use unit 3 (CONU_SNIPMAP) when opening the console.device - I tried this, but it would not do the trick. Could someone with experience with this let me know what I'm managing to do wrong? (I've included the entire routine that opens the window - It makes use of a private structure called LogUnique and LogPrivate which hold a lot of the different structures required for the library, but hopefully the general idea will still be able to be extracted..) /* From 2.0 includes... */ #define CONU_LIBRARY -1 /* No unit, just fill in Device */ #define CONU_STANDARD 0 /* Standard, unmapped console */ #define CONU_CHARMAP 1 /* Bind char map to console */ #define CONU_SNIPMAP 3 /* Bind char map w/snip to */ #ifdef USE20 #define CONS_UNIT CONU_SNIPMAP #else #define CONS_UNIT CONU_STANDARD #endif struct NewWindow LogWindow = { 20, /* Leftedge */ 30, /* Topedge */ 600, /* width */ 100, /* height */ -1, /* Detail pen - default ? */ -1, /* block pen - default ? */ 0, /* IFCMPFlags */ /* Other flags. */ WINDOWSIZING|WINDOWDRAG|WINDOWDEPTH|SMART_REFRESH, NULL, /* Gadget list */ NULL, /* Checkmark */ (UBYTE *)"Welmat log", /* name of window */ NULL, /* screen - default, (workbench)*/ NULL, /* bitmap - */ 32, /* Minimum width */ 32, /* Minimum height */ -1, /* max width, none */ -1, /* max height, none */ WBENCHSCREEN /* type */ }; static LogUnique *InitWindow(lp,loglist) LogPrivate *lp; struct List *loglist; { struct NewWindow newWindow; LogUnique *lu; if((lu=AllocMem(sizeof(LogUnique),MEMF_CLEAR))==NULL) { return(NULL); } newWindow=LogWindow; newWindow.LeftEdge=lp->left; newWindow.TopEdge=lp->top; newWindow.Width=lp->width; newWindow.Height=lp->height; newWindow.Title=(UBYTE *)lp->name; newWindow.Type=WBENCHSCREEN; lu->name=lp->name; lu->ref=0; if((lu->idcmp_port = CreatePort(0,0))==NULL) goto unique; if((lu->log=OpenWindow(&newWindow))==NULL) { fprintf(stderr,"Couldn't open window %s\n",lp->name); goto port; } lu->req.io_Data = (APTR)lu->log; lu->req.io_Message.mn_Node.ln_Type = NT_MESSAGE; lu->req.io_Message.mn_ReplyPort = lu->idcmp_port; if(OpenDevice("console.device", CONS_UNIT, &lu->req, 0L)) { fputs("Couldn't open a console.device for logs\n",stderr); CloseWindow(lu->log); port: DeletePort(lu->idcmp_port); unique: FreeMem(lu,sizeof(LogUnique)); fputs("Init window failed\n",stderr); return(FALSE); } lu->log_Node.ln_Pri=lp->windownum; lp->logWindow=lu; Enqueue(loglist,lu); return(TRUE); } --- Opinions expressed in this message are my Own. I represent nobody else. Russell McOrmond rwm@Atronx.OCUnix.On.Ca {tigris,alzabo,...}!atronx!rwm FidoNet 1:163/109 Net Support: (613) 230-2282 Amiga-Fidonet Support 1:1/109 Gateway for .Amiga.OCUnix.On.Ca