FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour bug in xBrowse in Linux with Wine
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
bug in xBrowse in Linux with Wine
Posted: Thu Jun 16, 2011 09:38 PM
Hi,

When using an .exe in Ubuntu with Wine, when calling XBROWSE from a DIALOG, it produces this error:

Code (fw): Select all Collapse
Application
===========
   Path and name: Z:\home\ubuntu\test\xbrowse\LINUX.exe (32 bits)
   Size: 2,475,520 bytes
   Time from start: 0 hours 0 mins 3 secs 
   Error occurred at: 06/16/11, 14:33:49
   Error description: Error BASE/1004  No exported method: EVAL
   Args:
     [   1] = U   

Stack Calls
===========
   Called from:  => (b)EVAL(0)
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE(386)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYCOUNT(0)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:REFRESH(1144)
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE(411)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:RESIZE(0)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1499)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(11282)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3409)
   Called from:  => SETSCROLLRANGE(0)
   Called from: .\source\classes\SCRLLBAR.PRG => (b)TSCROLLBAR(93)
   Called from: .\source\classes\SCRLLBAR.PRG => TSCROLLBAR:SETRANGE(0)
   Called from: .\source\classes\SCRLLBAR.PRG => TSCROLLBAR:WINNEW(203)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:INITIATE(805)
   Called from:  => __OBJSENDMSG(0)
   Called from: .\source\function\HARBOUR.PRG => OSEND(210)
   Called from: .\source\function\HARBOUR.PRG => ASEND(178)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE(657)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(917)
   Called from:  => DIALOGBOX(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
   Called from: linux.prg => MAIN(112)



The code is:

Code (fw): Select all Collapse
     DEFINE DIALOG oDlg RESOURCE "SELECT" TITLE "Please, Select"
     
     oBrowse := TXBrowse():New( oDlg )

     aBrowse   := { { { || FIELD->CODE       }, "Code", 50, 0 },;
                    { { || FIELD->NAME       }, "Name", 5160, 0 } }

     oBrowse:CreateFromResource(101)


     REDEFINE BUTTON ID 201 OF oDlg ACTION( lSave := .T., oDlg:End() )


     ACTIVATE DIALOG oDlg CENTERED


In old FWH versions worked fine.

In Windows, the code works perfect.

What is wrong?.

Thank you very much.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bug in xBrowse
Posted: Fri Jun 17, 2011 12:03 AM

This code is "unsafe".

It works when a DBF file is already open and is the default alias, because an alias is not set with oBrw:cAlias := <alias> and oBrw:SetRDD() is not used. Nothing to do with this error, but the array aBrowse is not used in this code.

Regards



G. N. Rao.

Hyderabad, India
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: bug in xBrowse
Posted: Fri Jun 17, 2011 08:13 AM

Hi,

Thank you, but I don´t understand.

The code works fine in Windows, but not in Linux.

The error does not refer to DBF.

Can be fixed?.

Thank you.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bug in xBrowse
Posted: Fri Jun 17, 2011 08:25 AM

It is possible that the DBF you wanted to browse was getting open on windows but on on Linux.

Please make sure that the alias you are browsing is really open by checking
? SELECT( <aliasname> ) > 0
or
? USED()
before creating the xbrowse.

When no DBF file is open when the browse is activated, SetRDD() is not implemented and the codeblocks including bKeyCount are not assigned. KeyCount() method tries to evaluate bKeyCount codeblock which is NIL resulting in the error as reported.

Regards



G. N. Rao.

Hyderabad, India
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: bug in xBrowse
Posted: Fri Jun 17, 2011 08:55 AM
Mr Nao:

The dbf is opened ok.

If I put xbrowse(), it works fine.

Code (fw): Select all Collapse
USE CUSTOMER
xBrowse()



In my sample, I have added:

oBrowse:cAlias := "CUSTOMER"
oBrowse:SetRDD()

just before oBrowse:CreateFromResource(101)

and now works fine in Linux :-).

When must I add cAlias := "CUSTOMER" and SetRDD(), just before oBrowse := TXBrowse():New( oDlg ) or before CreateFromResource()?.

Thank you for quick support!!!.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bug in xBrowse in Linux with Wine
Posted: Fri Jun 17, 2011 12:59 PM
When must I add cAlias := "CUSTOMER" and SetRDD(), just before oBrowse := TXBrowse():New( oDlg ) or before CreateFromResource()?.

Immediately after oBrowse := TXBrowse()
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bug in xBrowse in Linux with Wine
Posted: Fri Jun 17, 2011 01:03 PM
Command syntax takes care of many issues automatically and avoids all such pitfalls.
The above code can be written as
Code (fw): Select all Collapse
USE CUSTOMER
DEFINE DIALOG oDlg RESOURCE "SELECT" TITLE "Please, Select"
REDEFINE XBROWSE oBrowse ID 101 OF oDlg ;
   COLUMNS "Code", "Name" SIZES 50,500 ;
   ALIAS "CUSTOMER"
REDEFINE BUTTON ID 201 OF oDlg ACTION( lSave := .T., oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED
CLOSE CUSTOMER
Regards



G. N. Rao.

Hyderabad, India
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: bug in xBrowse in Linux with Wine
Posted: Fri Jun 17, 2011 02:04 PM

Thank you very much.

It works fine now.

But when I call a xBrowse such as:

oVMenuBrowse := TXBrowse():New( oDlg )

oVMenuBrowse:nTop:=00
oVMenuBrowse:nLeft:=72
oVMenuBrowse:nRight:= (oDlg:nWidth()-10)/2 //nWidth=150
oVMenuBrowse:nBottom:= (oDlg:nHeight()-21)/2 //nHeight=200

if I use @ 00,72 XBROWSE... how do I indicate nRight and nBottom?.

Thank you.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: bug in xBrowse in Linux with Wine
Posted: Sat Jun 18, 2011 03:20 AM

@ 0,72 XBROWSE <clauses> SIZE -10,-21 PIXEL OF oDlg <moreClauses>

Negative size instructs the xbrowse to leave 10 pixels margin to the right and 21 pixels margin at the bottom. XBrowse automatically calculates the coordinates based on the width and height of the Dialog or Window. ( We also need not worry about dividing by 2 in case of dialogs. All that is taken care of by XBrowse)

On windows, these margins are retained even when the window is re-sized. We do not have to write any code to resize the browse when window is resized.

Regards



G. N. Rao.

Hyderabad, India
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: bug in xBrowse in Linux with Wine
Posted: Sun Jun 19, 2011 11:18 AM

Thank you very much.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82

Continue the discussion