Page 1 of 2

Using oBrw:print() only prints whats on screen

PostPosted: Sun Aug 24, 2008 5:26 pm
by hag
I have a 15 column browse and the user can move and eliminate columns . I'd like to print the oBrw with the user changes.
The oBrw:print() seems to print only what is on the screen. Is there a way to print the entire oBrw with the changes and to the last record being used?

PostPosted: Mon Aug 25, 2008 10:40 am
by Antonio Linares
Harvey,

Try with oBrw:Report()

PostPosted: Mon Aug 25, 2008 2:12 pm
by hag
Antonio:

>Try with oBrw:Report()

Get an argument error...

Error description: Error BASE/1111 Argument error: LEN
Args:
[ 1] = U

Stack Calls
===========
Called from: => LEN(0)
Called from: => TRCOLUMN:STABILIZE(0)
Called from: => (b)STABILIZE(0)
Called from: => AEVAL(0)
Called from: => TREPORT:STABILIZE(0)
Called from: => TREPORT:ACTIVATE(0)
Called from: => TXBROWSE:REPORT(0)
Called from: .\JBROWSE.PRG => TOEXITPRINT(6091)

PostPosted: Mon Aug 25, 2008 2:50 pm
by James Bott
>Called from: .\JBROWSE.PRG => TOEXITPRINT(6091)

What is on line 6091?

Regards,
James

PostPosted: Mon Aug 25, 2008 2:52 pm
by hag
James
Line 6091 == oBrw:report()

PostPosted: Mon Aug 25, 2008 3:06 pm
by Antonio Linares
Harvey,

How are you creating the browse ?

Please post here the source code for it, thanks

PostPosted: Mon Aug 25, 2008 3:19 pm
by hag
Sent oBrw creation and a typical column.

Code: Select all  Expand view

   getcoors(ownd1:nTop,ownd1:nLeft,ownd1:nBottom,ownd1:nRight)

   if ownd1:nright >= 1020 //.and. ownd1:nright   < 1028   

      if bFont[1]   <= 16

         oDlg:bResized  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,4,arect[ 4 ]-arect[ 2 ] -16, ; //16
         aRect[3]-aRect[1]-175,.t.);      //150                           // 130
         ,oBtn1:move(arect[3] -aRect[1]- 89,11  ,,,.t.);  //14    *
         ,oBtn5:move(arect[3] -aRect[1]- 89,197 ,,,.t.);  //106
         ,oBtn7:move(arect[3] -aRect[1]- 89,380 ,,,.t.);  //16
         ,oBtn2:move(arect[3] -aRect[1]- 119,481 ,,,.t.);  //4002
         ,oBmp1:move(                    "",11 ,,,.t.);  //calculate
         ,oBmp5:move(arect[3] -aRect[1]- 149,380 ,,,.t.); // Info
         ,oBtn4:move(                    "",620 ,,,.t.);  //calculate
         ,oCbx:move(arect[3]  -aRect[1]- 89,575 ,,,.t.);  //Transfer data
         ,oCbx1:move(arect[3] -aRect[1]- 119,575 ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 119,11  ,,,.t.);  //15   *
         ,oCbx3:move(arect[3] -aRect[1]- 119,197 ,,,.t.);  //14
         ,oSay11:move(arect[3]-aRect[1]- 119,806 ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 111,806 ,,,.t.);  //
         ,oCbx4:move(                    "",728 ,,,.t.);  //reports
         ,oSay13:move(                   "",855 ,,,.t.);  //
         ,oSay20:move(arect[3] -aRect[1]-145,11  ,,,.t.); // 75   *   //120
         ,oSay21:move(arect[3] -aRect[1]-145,197 ,,,.t.); // 75   *
         ,oBtn3:move(arect[3]  -aRect[1]-119,380 ,,,.t.)} //103


      else

         oDlg:bResized  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,4,arect[ 4 ]-arect[ 2 ] -16, ; //16
         aRect[3]-aRect[1]-207,.t.);   //150 //175                           // 130
         ,oBtn1:move(arect[3] -aRect[1]- 102,5  ,,,.t.);  //14    *
         ,oBtn5:move(arect[3] -aRect[1]- 102,197 ,,,.t.);  //106
         ,oBtn7:move(arect[3] -aRect[1]- 102,380 ,,,.t.);  //16
         ,oBtn2:move(arect[3] -aRect[1]- 132,520 ,,,.t.);  //4002
         ,oBmp1:move(                    "",11 ,,,.t.);  //calculate
         ,oBmp5:move(arect[3] -aRect[1]- 168,380 ,,,.t.); // Info
         ,oBtn4:move(                    "",575 ,,,.t.);  //calculate
         ,oCbx:move(arect[3]  -aRect[1]- 102,605 ,,,.t.);  //Transfer data
         ,oCbx1:move(arect[3] -aRect[1]- 132,605 ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 132,5  ,,,.t.);  //15   *
         ,oCbx3:move(arect[3] -aRect[1]- 132,197 ,,,.t.);  //14
         ,oSay11:move(arect[3]-aRect[1]- 132,806 ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 111,806 ,,,.t.);  //
         ,oCbx4:move(                    "",675 ,,,.t.);  //reports
         ,oSay13:move(                   "",845 ,,,.t.);  //
         ,oSay20:move(arect[3] -aRect[1]-168,5  ,,,.t.); // 75   *   //120
         ,oSay21:move(arect[3] -aRect[1]-168,197 ,,,.t.); // 75   *
         ,oBtn3:move(arect[3]  -aRect[1]-132,380 ,,,.t.)} //103


         //,oBmp5:move(                    "",51 ,,,.t.);  //calculate

      endif             


   endif


   if (oWnd1:nRight > 600 .AND. oWnd1:nRight   < 1020)   

      bFont := getFontInfo(hFont)   

      if bFont[1]   <= 16

         ODLG:BRESIZED  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,1,arect[ 4 ]-arect[ 2 ] - 27, ;
         aRect[3]-aRect[1]-150,.t.);
         ,oBtn1:move(arect[3] -aRect[1]- 55,5,   , ,.t.); //14
         ,oBtn5:move(arect[3] -aRect[1]- 55,177  ,,,.t.); //106
         ,oBtn7:move(arect[3] -aRect[1]- 55,333  ,,,.t.); //16
         ,oBtn2:move(arect[3] -aRect[1]- 85,433  ,,,.t.); //4002
         ,oBmp1:move(                    "",11   ,,,.t.);  //calculate
         ,oBmp5:move(arect[3] -aRect[1]- 119,352 ,,,.t.); // Info
         ,oBtn4:move(                    "",600  ,,,.t.); //calculate
         ,oCbx:move(arect[3]  -aRect[1]- 55,519  ,,,.t.); //Transfer data
         ,oCbx1:move(arect[3] -aRect[1]- 85,519  ,,,.t.); //
         ,oCbx2:move(arect[3] -aRect[1]- 85,5    ,,,.t.); //15   
         ,oCbx3:move(arect[3] -aRect[1]- 85,177  ,,,.t.); //14
         ,oSay11:move(arect[3]-aRect[1]- 85,805  ,,,.t.); //
         ,oSay12:move(arect[3]-aRect[1]- 52,805  ,,,.t.); //
         ,oCbx4:move(                    "",680  ,,,.t.); //reports
         ,oSay13:move(                   "",804  ,,,.t.); //
         ,oSay20:move(arect[3]-aRect[1]- 115,5   ,,,.t.);// 75   *
         ,oSay21:move(arect[3]-aRect[1]- 115,177 ,,,.t.);// 75   *
         ,oBtn3:move(arect[3] -aRect[1]- 85,349  ,,,.t.),oBrw:refresh()} //103
      else
         oDlg:bResized  :=                           ;
         {|| aRect  := GetWndRect(oDlg:hWnd),    ;
         oBrw:Move( 24,4,arect[ 4 ]-arect[ 2 ] -16, ; //16
         aRect[3]-aRect[1]-175,.t.);   //150                           // 130
         ,oBtn1:move(arect[3] -aRect[1]- 89,5  ,,,.t.);  //14    *
         ,oBtn5:move(arect[3] -aRect[1]- 89,197 ,,,.t.);  //106
         ,oBtn7:move(arect[3] -aRect[1]- 89,380 ,,,.t.);  //16
         ,oBtn2:move(arect[3] -aRect[1]- 119,400 ,,,.t.);  //4002
         ,oBmp1:move(                    "",11 ,,,.t.);  //calculate
         ,oBmp5:move(                    "",51 ,,,.t.);  //calculate
         ,oBtn4:move(                    "",575 ,,,.t.);  //calculate
         ,oCbx:move(arect[3]  -aRect[1]-  89,605 ,,,.t.);  //Transfer data
         ,oCbx1:move(arect[3] -aRect[1]- 119,605 ,,,.t.);  //
         ,oCbx2:move(arect[3] -aRect[1]- 119,5  ,,,.t.);  //15   *
         ,oCbx3:move(arect[3] -aRect[1]- 119,197 ,,,.t.);  //14
         ,oSay11:move(arect[3]-aRect[1]- 119,806 ,,,.t.);  //
         ,oSay12:move(arect[3]-aRect[1]- 111,806 ,,,.t.);  //
         ,oCbx4:move(                    "",675 ,,,.t.);  //reports
         ,oSay13:move(                   "",845 ,,,.t.);  //
         ,oSay20:move(arect[3] -aRect[1]-145,5  ,,,.t.); // 75   *   //120
         ,oSay21:move(arect[3] -aRect[1]-145,197 ,,,.t.); // 75   *
         ,oBtn3:move(arect[3]  -aRect[1]-119,380 ,,,.t.)} //103
      endif             
   endif

   redefine column xbrowse oBrw ID 101 of oDlg cell lines //autocols //fastedit   

   if cFixoDbf   == .f.
      select bal       
      database oDbf       
      oDbf:GoTop()   
#translate oDbf:bal: => oDbf:
      oBrw:SetoDbf(oDbf)      
   else

      select gl
      database oDbf       
      oDbf:GoTop()   
      oBrw:SetoDbf(oDbf)      
#translate oDbf:gl: => oDbf:
      oBrw:nFreeze := 4       // freeze
   endif

    oBrw:nMARQueesTYLE := MARQSTYLE_HIGHLROW   



   msize := 68 // 78

   if mWhichCountry == .t. // CANADA   

      if !EMPTY(cFrecast)
         ADD COLUMN TO xbrowse oBrw data {|| trans(oBrw:oDbf:gl:trend, '@Z 999.9') };
         SIZE 40 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "TrendIt"

         ADD COLUMN TO xbrowse oBrw DATA {|| if(gl->gst == 1, "Yes", if(gl->gst == 0, " ",)) };
         SIZE 25 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "GST" // blank cursor colm
      else
         ADD COLUMN TO xbrowse oBrw DATA {|| if(gl->gst == 1, "Yes", if(gl->gst == 0, " ",)) };
         SIZE 25 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "GST" // blank cursor colm
      endif
   else   
      if !EMPTY(cFrecast)
         ADD COLUMN TO xbrowse oBrw data {|| trans(oBrw:oDbf:gl:trend, '@Z 999.9') };
         SIZE 40 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER "TrendIt"
      else
         //oBrw:hBmpCursor := LoadBitmap( GetResources(), "Z_Finger" )
         ADD COLUMN TO xbrowse oBrw DATA {|| if(gl->gst == 1, "   ", if(gl->gst == 0, " ",)) };
         SIZE 20 COLOR CLR_BLACK, CLR_WHITE LEFT HEADER " " // blank cursor colm
      endif
   endif      

   gl->(dbGoTop())

   oBrw:bLDblClick := { | nRow,nCol | if (nNewVar == 1,msginfo("Editing is not available while vewing this report."),(odlg:hide(),apicard( oBrw, nRow, nCol, odlg))),oBrw:refresh();
   ,oBrw:setfocus(),odlg:show(),needCalc(oDlg),oBrw:refresh(),odlg:setfocus(),mPassMess := .t.}

   oBrw:bKeyChar  := { | nKey,nRow,nCol | if(nKey=VK_RETURN,;
   (IF(nNewVar == 1,msginfo("Editing is not available while in this report.");
   ,(odlg:hide(),apicard( oBrw, nRow, nCol, odlg))),whatUsing(oDlg),oDlg:update(),oBrw:refresh(),oBrw:setfocus(),odlg:show(),needCalc(oDlg)),)}


   // 2007
   oBrw:bRClicked  := { | nRow,nCol | build(oBrw, nRow, nCol, odlg),oBrw:refresh(),oBrw:setfocus(),odlg:setfocus(),mPassMess := .t.}


   ADD COLUMN TO xBROWSE oBrw ;
   data {|| if(gl->title == repli('-', 30), repli(' ' , 30), ;
   if(gl->title == repli('=', 30), repli(' ', 30), ;
   eval(cBal))) };
   SIZE 140  LEFT HEADER "Account (dblclick to edit)"  COLOR CLR_BLACK,CLR_HGRAY   


   ADD COLUMN to xBrowse oBrw ;
   DATA {|| if(gl->title == repli('-', 30), repli(' ' , 30), ;
   if(gl->title == repli('=', 30), repli(' ', 30), ;
   if(gl->account == "2053" .or. gl->account == "2514".or. gl->account == "2632", repli(' ', 30), ;
   if(gl->account == "2733", repli(' ', 30), ;
   if(gl->account == "2833" .or. gl->account == "2933", repli(' ', 30), ;
   if(gl->account == "2998" .or. gl->account == "3355", repli(' ', 30), ;
   if(gl->account == "3485" , repli(' ', 30), ;
   trans(eval(bty13), '999,999,999') ))))))) };
   SIZE 71  RIGHT  HEADER cOne  COLOR CLR_BLACK,CLR_WHITE       

PostPosted: Mon Aug 25, 2008 3:33 pm
by James Bott
You may need to compile a copy of TXBROWSE.PRG and link it into your app, then make it error out, so you can find the line number in Txbrowse where the error is occuring.

Regards,
James

PostPosted: Mon Aug 25, 2008 4:03 pm
by James Bott
Here is a programming tip. This code:

Code: Select all  Expand view
if(gl->account == "2053" .or. gl->account == "2514".or. gl->account == "2632", repli(' ', 30), ;
   if(gl->account == "2733", repli(' ', 30), ;
   if(gl->account == "2833" .or. gl->account == "2933", repli(' ', 30), ;
   if(gl->account == "2998" .or. gl->account == "3355", repli(' ', 30), ;
   if(gl->account == "3485" , repli(' ', 30), ;


Could be simplified to:

Code: Select all  Expand view
if( at(gl->account, "2053 2514 2632 2733 2833 2933 2998 3355 3485") > 0, space(30), ... )


Or better yet, move the account numbers to a file so they are more easily updated without recompiling. So then you have something like:

Code: Select all  Expand view
if( at(gl->account, cSpecialAccounts) > 0, space(30), ... )


Regards,
James

PostPosted: Tue Aug 26, 2008 3:01 am
by hag
James

Thanks for the tip. I'm a real amature at this. I have only one program i've been dealing with for the last 18 years and I know my program and but I can use all the help can get. I don't do programing. Just the one. I am a practicing CPA in LA. Developed my prgram in '89 and been improving ever since. Fivewin has been a absolute life saver. I remember you from the old Omnicrom days. Never moved from fw192 til now and its been a pleasure converting to 32bits even though I have a number of things that don't seem to work right.

The theme issue is my concern at this time. It doesn't work. I get all the nice rounded dialogs and blue color if I use "windowsXP.manefest" or not. If I use the manifest nothing happens. None of the other items on my dialogs such as coloring borders of says and gets, rounded buttons etc. Just doesn't work. Any thoughts?

PostPosted: Tue Aug 26, 2008 3:15 am
by hag
James:

>You may need to compile a copy of TXBROWSE.PRG and link it into your >app, then make it error out, so you can find the line number in >Txbrowse where the error is occuring.

line txbrowse. 4282....

Thanks for your help.

PostPosted: Tue Aug 26, 2008 3:56 am
by James Bott
Harvey,

>The theme issue is my concern at this time. It doesn't work. I get all the nice rounded dialogs and blue color if I use "windowsXP.manefest" or not. If I use the manifest nothing happens. None of the other items on my dialogs such as coloring borders of says and gets, rounded buttons etc. Just doesn't work. Any thoughts?

Try compiling fwh\samples\win32.prg with buildh.bat or buildx.bat (depending on whether you are using Harbour or xHarbour) and see if the controls are themed.

I seem to remember you are using a DLL, is that true? I always use RC files instead--these are compiled right into the EXE. Perhaps there is a problem with the theme when using a DLL. Try converting your DLL to an RC (using Workshop; File Save As) and linking it into your app (see the buildh.bat for how).

I always had trouble trying to edit 32bit DLLs with Workshop--they end up corrupted. So, it is my suggestion to use RCs instead.

>I am a practicing CPA in LA.

Is your program a cash flow analysis program or something like that? If so, I remember conversing with you many years ago.

Regards,
James

PostPosted: Tue Aug 26, 2008 4:05 am
by hag

PostPosted: Tue Aug 26, 2008 4:10 am
by James Bott
Harvey,

Yes, the name of the program came to me right after I posted my last message. I think we had some discussions when you were getting ready to convert your old DOS version to Windows.

Glad to hear your program is still doing well.

Regards,
James

PostPosted: Tue Aug 26, 2008 4:22 am
by hag
Many many years ago. 1995...Thanks to fivewin.

If I compile my rc into exe. How are they called in the program.

Now is define odlg resources "Name"of etc...

since no longer using the dll what do I do?

Compiled win32 and has the theme.