1. wPrintF
- Posted by bobspringett <bobspringett at WANADOO.FR> Aug 25, 2000
- 491 views
I am trying to wPrintf an atom to a window using the attached code but I keep getting an error " type check failed s2=1." I also tried calling it an integer 'and a few other names' but always the same. The variable n is the one in question and all I need is to print a number in a certain position on the window. Can someone please tell me what I am doing wrong? CODE: procedure SideIndex() atom n x1=2 y1=editBoxHeight+2 n=1 for z=1 to screenCellsDown do setPenColor(DrawWin,rgb(200,200,200)) drawRectangle(DrawWin,True,x1+2,y1+2,x1+editBoxWidth-3,y1+editBoxHeight-3) setPenColor(DrawWin,BrightWhite) drawLine(DrawWin,x1,y1,x1+editBoxWidth,y1) drawLine(DrawWin,x1+1,y1+1,x1+editBoxWidth-2,y1+1) drawLine(DrawWin,x1,y1,x1,y1+editBoxHeight) drawLine(DrawWin,x1+1,y1+1,x1+1,y1+editBoxHeight-2) setPenColor(DrawWin,rgb(100,100,100)) drawLine(DrawWin,x1+2,y1+editBoxHeight-1,x1+editBoxWidth-1,y1+editBoxHeight-1) drawLine(DrawWin,x1+3,y1+editBoxHeight-2,x1+editBoxWidth-2,y1+editBoxHeight-2) drawLine(DrawWin,x1+editBoxWidth-1,y1+3,x1+editBoxWidth-1,y1+editBoxHeight-1) drawLine(DrawWin,x1+editBoxWidth-2,y1+2,x1+editBoxWidth-2,y1+editBoxHeight-2) indexPosX=floor(x1+(editBoxWidth/2)-(fontSize[1]/2)) indexPosY=floor(y1+(editBoxHeight/2)-(fontSize[2]/2)) setPosition(DrawWin,indexPosX,indexPosY) wPrintf(DrawWin,"%d",n) n+=1 y1+=editBoxHeight end for end procedure
2. Re: wPrintF
- Posted by David Cuny <dcuny at LANSET.COM> Aug 25, 2000
- 450 views
bobspringett wrote: > wPrintf(DrawWin,"%d",n) Unlike printf, wPrintf wants the third argument to be a sequence. Try: wPrintf(DrawWin,"%d",{s}) This should be fixed (Matt, could you do this?) by changing the definition in Win32Lib from: global procedure wPrintf( integer id, sequence s1, sequence s2 ) wPuts( id, sprintf( s1, s2 ) end procedure to: global procedure wPrintf( integer id, sequence s, object o ) wPuts( id, sprintf( s, o ) end procedure Sorry about that! -- David Cuny
3. Re: wPrintF
- Posted by Ad Rienks <kwibus at ZONNET.NL> Aug 25, 2000
- 468 views
Bob, The line should be: wPrintf(DrawWin, "%d", {n}) The procedure wPrintf wants a *sequence* as it's 3rd argument. That is because you can define more then 1 variable to be printed. Ad ----- Oorspronkelijk bericht ----- Van: bobspringett <bobspringett at WANADOO.FR> Aan: <EUPHORIA at LISTSERV.MUOHIO.EDU> Verzonden: vrijdag 25 augustus 2000 13:18 Onderwerp: wPrintF > I am trying to wPrintf an atom to a window using the attached code but I keep getting an error " type check failed s2=1." > wPrintf(DrawWin,"%d",n)
4. Re: wPrintF
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Aug 25, 2000
- 490 views
David Cuny wrote: > This should be fixed (Matt, could you do this?) by changing > the definition > in Win32Lib from: > > global procedure wPrintf( integer id, sequence s1, sequence s2 ) > wPuts( id, sprintf( s1, s2 ) > end procedure > > to: > > global procedure wPrintf( integer id, sequence s, object o ) > wPuts( id, sprintf( s, o ) > end procedure > > Sorry about that! > > -- David Cuny > OK. I'll probably post some other bug fixes later today, too. getPrinter wasn't working--thanks to Judith Evans for that one. Also I've got combo boxes correctly working with tab stops. As far as documentation goes, I'd say that a windows programming FAQ (with win32lib) would be a great idea. I haven't looked at them, but Wolfgang's tutorials are probably a good place to start. Even though (IMHO) win32lib is a great high level library to insulate the programmer from the win32 api (sort of like MFC for Euphoria). But, to code in windows, you still need to understand the basics of how things work--the same goes for DOS or Linux, of course. I don't think that this belongs in the win32lib docs proper. That should be reserved for documentation on using the library (the win32lib api, if you will :)--it's pretty big as it is. Matt
5. Re: wPrintF
- Posted by bobspringett <bobspringett at WANADOO.FR> Aug 25, 2000
- 499 views
Thanks Ad Regards Bob ----- Original Message ----- From: Ad Rienks <kwibus at ZONNET.NL> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, August 25, 2000 3:04 PM Subject: Re: wPrintF > Bob, > > The line should be: > wPrintf(DrawWin, "%d", {n}) > > The procedure wPrintf wants a *sequence* as it's 3rd argument. That is > because you can define more then 1 variable to be printed. > > Ad > > ----- Oorspronkelijk bericht ----- > Van: bobspringett <bobspringett at WANADOO.FR> > Aan: <EUPHORIA at LISTSERV.MUOHIO.EDU> > Verzonden: vrijdag 25 augustus 2000 13:18 > Onderwerp: wPrintF > > > > I am trying to wPrintf an atom to a window using the attached code but I > keep getting an error " type check failed s2=1." > > > wPrintf(DrawWin,"%d",n)
6. Re: wPrintF
- Posted by bobspringett <bobspringett at WANADOO.FR> Aug 25, 2000
- 458 views
David, That figures since I had previously written a routine to print the alphabet and then I used a sequence, and it was O.K.Thank you. Regards Bob ----- Original Message ----- From: David Cuny <dcuny at LANSET.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, August 25, 2000 2:52 PM Subject: Re: wPrintF > bobspringett wrote: > > > wPrintf(DrawWin,"%d",n) > > Unlike printf, wPrintf wants the third argument to be a sequence. Try: > > wPrintf(DrawWin,"%d",{s}) > > This should be fixed (Matt, could you do this?) by changing the definition > in Win32Lib from: > > global procedure wPrintf( integer id, sequence s1, sequence s2 ) > wPuts( id, sprintf( s1, s2 ) > end procedure > > to: > > global procedure wPrintf( integer id, sequence s, object o ) > wPuts( id, sprintf( s, o ) > end procedure > > Sorry about that! > > -- David Cuny