June 27, 2024, 08:45:19 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Need help desperately - MOVE/PRINT

Started by Dennisc, January 26, 2007, 09:45:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dennisc

January 26, 2007, 09:45:19 PM Last Edit: January 26, 2007, 09:48:57 PM by Dennisc
I need some help desperately with MOVE / PRINT to a Window. My program was working perfectly. I made a few changes and suddenly all the MOVE / PRINTs stopped working. I extracted the relevant code and isolated individual statements to try and find the offending code. I can virtually REM every statement other than the MOVE / PRINTs in the code below but I still cannot get them to work. As usual, I must be doing something wrong but cannot see it.

The code below is extracted from a 3000 line program to eliminate any errors caused by non-relevant code.

Any help gladly accepted.

Regards
Dennis

$MAIN
AutoDefine "Off"

DEF winMain: WINDOW 
DEF c:          STRING
DEF h,i,j,k,l,m,n,t,w,x,y,z:  INT   

DEF intMainRun: INT 
DEF prfStartMonth: INT
DEF prfStartYear: INT
DEF prfDuration: INT
DEF prfDurMonths: INT
DEF prfNumEvents: INT
DEF prfNumProbs: INT
DEF prfNumActs: INT
DEF prfNumRollups: INT

w = 1024 
h = 768 
l = 0 
t = 0   
 
OPENWINDOW winMain,l,t,w,h,@MINBOX|@MAXBOX|@MAXIMIZED,0,"Test Window",&wsubMainWindow 
 
SETWINDOWCOLOR winMain,RGB(236,233,216) 

CONTROL winMain,@Button,"Stats",750,640,80,40,@TABSTOP,112
CONTROL winMain,@Button,"Exit",850,640,80,40,@TABSTOP,113
CONTROL winMain,@Status,"Status",0,0,0,0,0,200

SETFONT winMain,"Arial",15,700,0,112
SETFONT winMain,"Arial",15,700,0,113 

GOSUB gsubScreenBoxes

intMainRun = 1 
WAITUNTIL intMainRun = 0 

CLOSEWINDOW winMain 
END 
 
SUB wsubMainWindow     
SELECT @CLASS 
CASE @IDCLOSEWINDOW 
intMainRun = 0 
CASE @IDCONTROL 
SELECT @CONTROLID 
CASE 112  :'Test
GOSUB msubStatistics
CASE 113  :'Exit
intMainRun = 0
ENDSELECT   
ENDSELECT 
RETURN 
ENDSUB

SUB msubStatistics
prfNumProbs = 0
prfNumActs = 0
prfNumRollups = 0
prfNumEvents = 0
prfDuration = 0
prfDurMonths = 0
GOSUB gsubScreenBoxes

BACKPEN(winMain,RGB(236,233,216))

MOVE winMain, 227,50
PRINT USING("&-##","Start Month: ",prfStartMonth)
MOVE winMain, 236,65
PRINT USING("&-####","Start Year: ",prfStartYear)
MOVE winMain, 193,80
PRINT USING("&-###","Duration (weeks): ",prfDuration)
MOVE winMain, 186,95
PRINT USING("&-##","Duration (months): ",prfDurMonths)
MOVE winMain, 400,50
PRINT USING("&-##","Defined activities: ",prfNumActs)
MOVE winMain, 400,65
PRINT USING("&-##","Defined Roll-ups: ",prfNumRollUps)
MOVE winMain, 398,80
PRINT USING("&-##","Defined problems: ",prfNumProbs)
MOVE winMain, 415,95
PRINT USING("&-##","Defined events: ",prfNumEvents)
RETURN
ENDSUB

SUB gsubScreenBoxes
SETLINESTYLE winMain, @LSSOLID, 3
LINE winMain,135,20,1000,20,RGB(180,180,180)
LINE winMain,135,20,135,625,RGB(180,180,180)
LINE winMain,135,625,1000,625,RGB(180,180,180)
LINE winMain,1000,625,1000,20,RGB(180,180,180)
LINE winMain,570,20,570,125,RGB(180,180,180)
LINE winMain,135,125,1000,125,RGB(180,180,180)
BACKPEN(winMain,RGB(236,233,216))
MOVE winMain, 320,30
PRINT "- STATISTICS -"
MOVE winMain, 265,133
PRINT "- MISSING FILES -"
MOVE winMain, 190,150
PRINT "BMPs"
MOVE winMain, 390,150
PRINT "DOCs"
MOVE winMain, 708,133
PRINT "- WARNINGS/ERRORS -"
RETURN
ENDSUB
Failure is only the opportunity to begin again more intelligently
www.denniscomninos.com

Ionic Wind Support Team

Probably somewhere else in the code.  Are you calling the API function SetTextAlign somewhere?  You can turn off updating of the current postion with that.

Paul.
Ionic Wind Support Team

LarryMc

if you change all the "PRINT" statements to "PRINT winMain," it will work
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

It tells you in the Help file that PRINT byitself is for printing to the console.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Dennisc

Thanks for the quick replies guys!!  ;D ;D

It strange how you can stare at a piece of code for hours and not see the obvious. One of the changes I had made was to do a Find/Replace "PRINT winMain," with "" so that I could temporarily test the stats and print it them to the console. When I reinserted back into the code, I forgot to reinstate the "winMain,"!!  :-[ :-[

Will have eyes and brain tested today!!  ;D Luckily only lost a few hours.

Quick response much appreciated!

Dennis
Failure is only the opportunity to begin again more intelligently
www.denniscomninos.com

LarryMc

what i do in my code is put the print winmain, and the print in my code for testing.  Then I just remark out the openconsole command when I'm through testing.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Nice catch Larry.  I was so involved in testing some other code at the moment that I missed it too ;)
Ionic Wind Support Team

Dennisc

Quotewhat i do in my code is put the print winmain, and the print in my code for testing.  Then I just remark out the openconsole command when I'm through testing.

I normally did this when I was using IBasic but for some rhyme or reason, it did not want to work in EBasic. I must qualify that however, when there is a window open and I "openconsole/print/DO:Inkey$<>""/closeconsole" it somehow does not want to work. I must admit, I did not try too hard so it could have been something on my side.

I must play around with conditional compiling and/or DEBUGPRINT.

Dennis
Failure is only the opportunity to begin again more intelligently
www.denniscomninos.com

LarryMc

If you compile the program as a window.exe then all you need is the openconsole command. Don't use the DO:Inkey$<>"".  When you close your program the console window will close with it.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library