xBrowse and report problem

xBrowse and report problem

Postby mtajkov » Mon Aug 31, 2015 7:38 pm

So far I have used fwh 12.08 and xHarbour build 1.2.1 now I just moved to a new version fwhh15.07. I use an application xBrowse and oBrw: report ("name" ...). With the transition to the new version Fivewin report no longer works. Program after the formation page just gets blocked. Please help.


Regards,
Milos
Best regards
Milos

[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
mtajkov
 
Posts: 130
Joined: Sun Mar 08, 2009 4:33 pm

Re: xBrowse and report problem

Postby nageswaragunupudi » Wed Sep 02, 2015 6:19 am

method report() is working for us.
We can not comment unless we have a sample program which we can compile at our end and test where it fails.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse and report problem

Postby mtajkov » Wed Sep 02, 2015 8:00 am

This is code:
Code: Select all  Expand view

function BrowRJ()

         Local oDlgBrow
     Private oBrw,mPolje:="Bez filtera",mFilter,mRadFil:=1,oRadFil

DBSelectArea(cCompany+"_RadJed")
   OrdSetFocus("RadJed_naz")

 aStruct := {{"RadJed_Id","C",3,0},;
            {"Naziv","C",30,0}}

   dbCreate( "TEMPODE", aStruct )


      USE TEMPODE NEW


  nErr := oSql:exec("SELECT * FROM " + cRadJed,,.t.,,"TempOde.dbf")

  if nErr != 0
    MsgInfo("Greška pri upitu","Greška")
  endif
     
         DEFINE DIALOG oDlgBrow  NAME "xPregled";
                TITLE "SPISAK RADNIH JEDINICA"
       

   REDEFINE XBROWSE oBrw ID 101 ALIAS "TempOde" ;
                FONT oFontBrw;
                OF oDlgBrow

   oCol := oBrw:AddCol()
   oCol:AddResource("OFF")
   oCol:AddResource("ON")
   oCol:cHeader   := " "
   oCol:bBmpData  := { || iif( empty(TempOde->Naziv) ,1,2) }
   oCol:oDataFont := oFontBrw

   oCol := oBrw:AddCol()
   oCol:bStrData  := { || RadJed_Id}
   oCol:cHeader   := "Šifra"
   oCol:nWidth    := 40
   oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ),DBSelectArea("TempOde"),DBCREATEINDEX("TempOde","RadJed_Id",{|| RadJed_Id}), ::oBrw:Refresh() }
   oCol:oDataFont := oFontBrw

   oCol := oBrw:AddCol()
   oCol:bStrData  := { || Naziv}
   oCol:cHeader   := "Odeljenje"
   oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ),DBSelectArea("TempOde"),DBCREATEINDEX("TempOde","Naziv",{|| Naziv}), ::oBrw:Refresh() }
   oCol:oDataFont := oFontBrw

   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:lColDividerComplete := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nFooterLines        := 1
   oBrw:nDataLines          := 1
   oBrw:lFooter             := .t.
   oBrw:SetRDD()

       oBrw:bRClicked := { | nRow, nCol | ShowPopup( nRow, nCol, oDlgBrow, oBrw ) }

     oBrw:bLDblClick = { | nRow, nCol | TraRJ(TempOde->RadJed_Id),oDlgBrow:End() }
     oBrw:bKeyChar   = { | nKey, nFlags | if( nKey==VK_RETURN,(TraRJ(TempOde->RadJed_Id),oDlgBrow:End()),NIL) }

        REDEFINE RADIO oRadFil VAR mRadFil ID 31,32 OF oDlgBrow;
                 ON CHANGE oFilter:SetFocus()

        REDEFINE COMBOBOX oPolje VAR mPolje ITEMS {"Bez filtera","RadJed_Id","Naziv"} ID 21 OF oDlgBrow

        REDEFINE GET oFilter VAR mFilter ID 22 OF oDlgBrow;
             PICTURE "@!";
                 FONT oFont

           REDEFINE BTNBMP ID 23 OF oDlgBrow RESOURCE "xKljuc" NOBORDER TOOLTIP "Postavi filter" ;
            ACTION (PuniDbf(mFilter,mPolje),iif(mRadFil=1,(oBrw:GoTop(),oBrw:Refresh(),oBrw:SetFocus()),(oBrw:Refresh(),oBrw:SetFocus())))

       REDEFINE BTNBMP ID 11 OF oDlgBrow;
            RESOURCE "Izlaz" LEFT 2007 PROMPT "   &Izlaz  ";
            ACTION oDlgBrow:End()

           REDEFINE BTNBMP ID 17 OF oDlgBrow RESOURCE "Stampac" NOBORDER TOOLTIP "Izbor štampača" ;
            ACTION PrinterSetup()
       
       REDEFINE BTNBMP oBtnSta ID 18 OF oDlgBrow ;
            RESOURCE "Printer16" LEFT 2007 PROMPT "  &Štampaj  ";
            ACTION (oBrw:Report("SPISAK RNIH JEDINICA"),oBrw:Refresh(),oBrw:GotFocus())
   
     ACTIVATE DIALOG oDlgBrow CENTERED ON INIT oBrw:SetFocus()

 DBSelectArea("TempOde")
DbCloseArea("TempOde")

DBSelectArea(cCompany+"_RadJed")

return .t.

 


Regards,
Miloš
Best regards
Milos

[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
mtajkov
 
Posts: 130
Joined: Sun Mar 08, 2009 4:33 pm

Re: xBrowse and report problem

Postby nageswaragunupudi » Sat Sep 05, 2015 4:10 am

We can build and run the above code exactly at our end, for want to rc file, dbfs and other functions used in the program.

We therefore created a new prg file using your code to build the xbrowse and using dummy data similar to the dbf you have used. This is the code:
Code: Select all  Expand view
#include "Fivewin.ch"

function Main()

   field RadJed_ID, Naziv

   local aStruct, oBrw, oCol, oDlgBrow, oFontBrw

   aStruct := {{"RadJed_Id","C",3,0},;
            {"Naziv","C",30,0}}

   dbCreate( "TEMPODE", aStruct )

   USE TEMPODE NEW

/*
  nErr := oSql:exec("SELECT * FROM " + cRadJed,,.t.,,"TempOde.dbf")

  if nErr != 0
    MsgInfo("Greška pri upitu","Greška")
  endif
*/


   FW_ArrayToDbf( { { "123", "ABC" }, { "234", "" }, { "345", "GHI" }, { "456", "" } } )
   GO TOP

   DEFINE FONT oFontBrw NAME "ARIAL" SIZE 0,-14

   DEFINE DIALOG oDlgBrow TITLE "SPISAK RADNIH JEDINICA" SIZE 460,300 PIXEL

   @ 40,10 XBROWSE oBrw SIZE -10,-10 PIXEL ALIAS "TempOde" OF oDlgBrow NOBORDER

   oCol := oBrw:AddCol()
   oCol:AddBmpFile( "c:\fwh\bitmaps\off.bmp" )
   oCol:AddBmpFile( "c:\fwh\bitmaps\on.bmp" )
   oCol:cHeader   := " "
   oCol:bBmpData  := { || iif( empty(TempOde->Naziv) ,1,2) }
   oCol:oDataFont := oFontBrw

   oCol := oBrw:AddCol()
   oCol:bStrData  := { || RadJed_Id}
   oCol:cHeader   := "Šifra"
   oCol:nWidth    := 40
   oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ),DBSelectArea("TempOde"),DBCREATEINDEX("TempOde","RadJed_Id",{|| RadJed_Id}), ::oBrw:Refresh() }
   oCol:oDataFont := oFontBrw

   oCol := oBrw:AddCol()
   oCol:bStrData  := { || Naziv}
   oCol:cHeader   := "Odeljenje"
   oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ),DBSelectArea("TempOde"),DBCREATEINDEX("TempOde","Naziv",{|| Naziv}), ::oBrw:Refresh() }
   oCol:oDataFont := oFontBrw

   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:lColDividerComplete := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nFooterLines        := 1
   oBrw:nDataLines          := 1
   oBrw:lFooter             := .t.
   oBrw:SetRDD()                   // Remove this line. Superfluous and not desirable

       oBrw:bRClicked := { | nRow, nCol | ShowPopup( nRow, nCol, oDlgBrow, oBrw ) }

     oBrw:bLDblClick = { | nRow, nCol | TraRJ(TempOde->RadJed_Id),oDlgBrow:End() }
     oBrw:bKeyChar   = { | nKey, nFlags | if( nKey==VK_RETURN,(TraRJ(TempOde->RadJed_Id),oDlgBrow:End()),NIL) }

   oBrw:CreateFromCode()

   @ 10,10 BUTTON "Štampaj" SIZE 40,15 PIXEL OF oDlgBrow ACTION ( oBrw:Report( "SPISAK RNIH JEDINICA" ), oBrw:SetFocus() )

     ACTIVATE DIALOG oDlgBrow CENTERED ON INIT oBrw:SetFocus()

   RELEASE FONT oFontBrw

return nil

static function TraRJ();return nil
static function ShowPopup();return nil
 

This is the screenshot of the browse:
Image

Clicking on the button executes oBrw:Report( <name> )
Screen shot of Preview of Report
Image

You may please see that the oBrw:Report is working with your code.
The above program can be compiled and tested independently on any computer.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse and report problem

Postby nageswaragunupudi » Sat Sep 05, 2015 4:15 am

We would also like to suggest the recommended way of writing the above code.
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   field RadJed_ID, Naziv

   local aStruct, oBrw, oCol, oDlgBrow, oFontBrw

   aStruct := {{"RadJed_Id","C",3,0},;
            {"Naziv","C",30,0}}

   dbCreate( "TEMPODE", aStruct )

   USE TEMPODE NEW

   FW_ArrayToDbf( { { "123", "ABC" }, { "234", "" }, { "345", "GHI" }, { "456", "" } } )
   GO TOP
   INDEX ON RADJED_ID TAG ID    TO TMP MEMORY
   INDEX ON NAZIV     TAG NAZIV TO TMP MEMORY ADDITIVE
   SET ORDER TO TAG ID
   GO TOP

   DEFINE FONT oFontBrw NAME "ARIAL" SIZE 0,-14

   DEFINE DIALOG oDlgBrow TITLE "SPISAK RADNIH JEDINICA" SIZE 460,300 PIXEL FONT oFontBrw

   @ 40,10 XBROWSE oBrw SIZE -10,-10 PIXEL ALIAS "TempOde" OF oDlgBrow ;
      COLUMNS "EMPTY(NAZIV)", "RADJED_ID", "NAZIV" ;
      HEADERS " ", "Sifra", "Odeljenje" ;
      AUTOSORT FOOTERS LINES NOBORDER

   WITH OBJECT oBrw
      :nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
      :aCols[ 1 ]:SetCheck( { "c:\fwh\bitmaps\off.bmp", "c:\fwh\bitmaps\on.bmp" } )
      :bLDblClick          = { | nRow, nCol | TraRJ(TempOde->RadJed_Id),oDlgBrow:End() }
      :bKeyChar            = { | nKey, nFlags | if( nKey==VK_RETURN,(TraRJ(TempOde->RadJed_Id),oDlgBrow:End()),NIL) }
      :bPopUp              := { || PopMenu() }
      :CreateFromCode()
   END

   @ 10,10 BUTTON "Štampaj" SIZE 40,15 PIXEL OF oDlgBrow ACTION ( oBrw:Report( "SPISAK RNIH JEDINICA" ), oBrw:SetFocus() )

   ACTIVATE DIALOG oDlgBrow CENTERED
   RELEASE FONT oFontBrw

return nil

static function PopMenu()

   local oPop

   MENU oPop POPUP 2007
      MENUITEM "One"
      MENUITEM "Two"
      MENUITEM "Three"
   ENDMENU

return oPop

static function TraRJ();return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10622
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests