Strange Error with xbrowse-restorestate

Re: Strange Error with xbrowse-restorestate

Postby James Bott » Wed Nov 03, 2010 10:01 pm

Frank,

I suggest comparing your browse definition with that in testxbrw.prg to see if you can find what might be triggering the error. It would be very helpful if you could create a simple test program that shows the error.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Error with xbrowse-restorestate

Postby MdaSolution » Thu Nov 04, 2010 8:52 am

I think you made an error because the string of state is not ok

I suggest to try to save a normal state before to try your test

the paintheader() method must read exactly fields :

sample

Customer=21;1:150:S;2:150:S;3:150:S;4:150:S

the number of record 21

the first column 1
the size 150
show or Hide S

the second column 2
the size 150
show or Hide S


....


until to 4
FWH .. BC582.. xharbour
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: Strange Error with xbrowse-restorestate

Postby frose » Thu Nov 04, 2010 11:22 am

Hi MdaSolution,

thanks for your comment.
The format of <cState> was changed to something in Hex starting with "XSS:..." in FWH 1009 or 1010.
The problem starts after updating from 1008 to 1010 without changing the source!

James,

yes, a little sample helps in any case, here it comes: :)
Code: Select all  Expand view  RUN
#include "fivewin.ch"
#include "xbrowse.ch"

function Main()

   local oWnd, oBrw
   LOCAL cState := ""
   LOCAL aState

   cState :=    cState := "XSS:41E70006004123000200430D005265417272616E6765436F6C73410E0003004E0100314E0100324E0100334115000200430B005F6E526F774865696768744E02003138412E0002004308005F6E576964746873411E0003004E06003932332E30384E06003130372E36394E0700313932332E303841230002004307005F6C486964657341140003004C03002E462E4C03002E462E4C03002E462E411C0002004309005F6347727048647273410B000300550000550000550000412E0002004309005F6348656164657273411D000300430A00506172612E2D4E616D654304005765727443040054657874"
   
   REQUEST DBFCDX
   USE RSTRSTT
   INDEX ON Field->Prmtr_txt TO RSTRSTT
   SET ORDER TO "RSTRSTT"
   GO TOP

   DEFINE WINDOW oWnd TITLE "Test RestoreState() FWH 1010"

   @ 0, 0 XBROWSE oBrw OF oWnd LINES CELL

   oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW

   oBrw:CreateFromCode()

   aState := ARead( HexToStr( SubStr( cState, 5 ) ) )

   AltD()
   
   oBrw:RestoreState( cState )

   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd VALID ( cState := oBrw:SaveState(), .T. )

   AltD()
   
return NIL

 


The source and the reqired dbf are here: http://depositfiles.com/files/jqmd4f3do
Last edited by frose on Thu Nov 04, 2010 6:01 pm, edited 1 time in total.
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Strange Error with xbrowse-restorestate

Postby frose » Thu Nov 04, 2010 12:48 pm

Unfortunately the sample is working with the right value for <cState>:

cState :=
"XSS:41E70006004123000200430D005265417272616E6765436F6C73410E0003004E0100314E0100324E0100334115000200430B005F6E526F774865696768744E02003138412E0002004
308005F6E576964746873411E0003004E06003932332E30384E06003130372E36394E0700313932332E303841230002004307005F6C486964657341140003004C03002E462E4C03002E4
62E4C03002E462E411C0002004309005F6347727048647273410B000300550000550000550000412E0002004309005F6348656164657273411D000300430A00506172612E2D4E616D654
304005765727443040054657874"

But it's only working in this sample, my application still crashes:

Error description: Error BASE/1004 Class: 'NIL' has no exported method: EVAL
Args:
[ 1] = U

Stack Calls
===========
Called from: => EVAL(0)
Called from: xbrowse.prg => (b)TXBROWSE:TXBROWSE(385)
Called from: => TXBROWSE:KEYCOUNT(0)
Called from: xbrowse.prg => TXBROWSE:REFRESH(1131)
Called from: xbrowse.prg => TXBROWSE:RESTORESTATE(5447)
Called from: my_txbrowse.prg => MY_RESTORESTATE(2458)
Called from: my_txbrowse.prg => MY_TXBROWSE(637)
Called from: my_browse.prg => MY_BROWSE(116)
Called from: C:\xHarbour\SewIS-PPS\my_application.prg => (b)BUILDMENU(1405)
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(437)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND(1029)
Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:COMMAND(243)
Called from: => TMDIFRAME:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(3394)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(978)
Called from: C:\xHarbour\SewIS-PPS\my_application.prg => MAIN(571)
Last edited by frose on Thu Nov 04, 2010 6:17 pm, edited 2 times in total.
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Strange Error with xbrowse-restorestate

Postby gkuhnert » Thu Nov 04, 2010 1:58 pm

So, I narrowed down the error I get. The problem is with getpvprofstr()
Because if I write down the xBrowse-Information with savestate the result in my ini-file is:
XSS:419B020600416D000200430D005265417272616E6765436F6C7341580013004E0100314E0100324E0100334E0100344E0100354E0100364E0100374E0100384E0100394E020031304E020031314
E020031324E020031334E020031344E020031354E020031364E020031374E020031384E020031394115000200430B005F6E526F774865696768744E02003138417B0002004308005F6E576964746873
416B0013004E020031374E020038304E020035394E020038304E03003232304E020033384E03003135304E03003135304E020037334E03003232304E03003239304E03003130384E020039344E02003
3384E03003130384E0400313532324E03003130384E020039344E0200333841830002004307005F6C486964657341740013004C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E4
62E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E46
2E4C03002E462E414C0002004309005F6347727048647273413B00130055000055000055000055000055000055000055000055000055000055000055000055000055000055000055000055000055000
055000055000041BB0002004309005F634865616465727341AA001300430700566F726C6167654306005465726D696E4307004B656E6E756E674307004B642E2D4E722E430700566F726E616D654304
004E616D6543070054656C65666F6E4304004C616E64430300504C5A4303004F727443060053747261DF65430600556D7361747A430000550000430F00556D732E2D53742E2D49442D4E722E430E00
417566747261677366656C646572430600556D7361747A4305004F6666656E4304004A616872


whereas getpvprofstr() only gets:
XSS:419B020600416D000200430D005265417272616E6765436F6C7341580013004E0100314E0100324E0100334E0100344E0100354E0100364E0100374E0100384E0100394E020031304E020031314
E020031324E020031334E020031344E020031354E020031364E020031374E020031384E020031394115000200430B005F6E526F774865696768744E02003138417B0002004308005F6E576964746873
416B0013004E020031374E020038304E020035394E020038304E03003232304E020033384E03003135304E03003135304E020037334E03003232304E03003239304E03003130384E020039344E02003
3384E03003130384E0400313532324E03003130384E020039344E0200333841830002004307005F6C486964657341740013004C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E4
62E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E462E4C03002E46
2E4C03002E462E414C0002004309005F6347727048647273413B00130055000055000055000055000055000055000055000055000055000055000055000055000055000055000055000055000055000
055000055000041BB0002004309005F634865616465727341AA001300430700566F726C


So it looks like savestate uses a huge lot of place and getpvprofstr() is only able to recover 1kb of this information resulting in errors that are not directly related to the problem.

Any suggestions? Is there a possibility to use savestate in a way it needs less bytes?
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Strange Error with xbrowse-restorestate

Postby James Bott » Thu Nov 04, 2010 2:32 pm

Gilbert,

see fwh\source\winapi\profile.c

This line:

#ifdef __HARBOUR__
HB_FUNC( GETPVPROFSTRING )
#else
HB_FUNC( GETPVPROFS )
#endif
{
BYTE bBuffer[ 1024 ]; <<--

It seems it is only allocating a 1k buffer for the data. Perhaps try increasing that to see if it solves the problem. If it does we can ask Antonio about making that change.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Error with xbrowse-restorestate

Postby gkuhnert » Thu Nov 04, 2010 3:05 pm

James,

thanks a lot !

Now I'm trying what you suggested and get following error: (I copied the source code to my c-file "ctofunc.c")
Error E2342 CTOFUNC.C 256: Type mismatch in parameter 'lpKeyName' (wanted 'const signed char *', got 'int') in function HB_FUN_GETPVPROFSTRING


this is the source:
Code: Select all  Expand view  RUN
HB_FUNC( GETPVPROFSTRING )
{
   BYTE bBuffer[ 2048 ];
   WORD wLen;

   wLen = GetPrivateProfileString( hb_parc( 1 ),     // Section
                                   IF( HB_ISCHAR( 2 ), hb_parc( 2 ), 0 ),   // Entry
                                   hb_parc( 3 ),     // Default
                                   ( char * ) bBuffer,        // Destination Buffer
                                   sizeof( bBuffer ) - 1,   // M x Len
                                   hb_parc( 4 ) );   // INI File (<= line 256 in my sourcecode )
   if( wLen )
      hb_retclen( ( char * ) bBuffer, wLen );
   else
      hb_retc( "" );
}
 
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Strange Error with xbrowse-restorestate

Postby James Bott » Thu Nov 04, 2010 3:21 pm

Gilbert,

Sorry, I don't know much about C. I suggest trying to compile the unchanged profile.c program with your current compiler and parameters to see if that works. If it does, then it is something specific about your ctofunc.c program that is causing the problem.

You could also try using BEGINDUMP/ENDDUMP and put the function right into your PRG.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Error with xbrowse-restorestate

Postby gkuhnert » Thu Nov 04, 2010 3:33 pm

James (& others who might know a little more about c)

the error stays the same if I include the function in one of my PRG's

(I also get a warning: "Warning W8064 EHO.prg 2328: Call to function 'HB_ISCHAR' with no prototype in function HB_FUN_GETPVPROFSTRING", but I think the error mentioned before is causing the trouble, as this is only a warning)
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Strange Error with xbrowse-restorestate

Postby James Bott » Thu Nov 04, 2010 4:42 pm

Gilbert,

Please try compiling the profile.c program to see if that works OK. If so, then you can just include the OBJ in your program.

Also, did you inlcude the INCLUDEs that are in profile.c in your ctofunc.c program?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Error with xbrowse-restorestate

Postby gkuhnert » Thu Nov 04, 2010 4:48 pm

James,

James Bott wrote:Please try compiling the profile.c program to see if that works OK. If so, then you can just include the OBJ in your program.

If I do that I get numerous errors about other functions in there. So I want to reduce the possible error range. As the only function I want to try is "GetPvProfString" I included that one in my c-function-file as well in one of my PRG's. And I get the same error in both cases. And the error points at a problem with the type of the variable, so it cannot be a problem with one of the other functions in my .c (in this case, the error message should differ when compiled in my .c


James Bott wrote:Also, did you inlcude the INCLUDEs that are in profile.c in your ctofunc.c program?

Yes of course. I forgot it the first time and got lots of errors because the compiler didn't recognize some constants.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Re: Strange Error with xbrowse-restorestate

Postby James Bott » Thu Nov 04, 2010 5:10 pm

Gilbert,

If I do that I get numerous errors about other functions in there


OK, this is important info. Presumably, Antonio is compiling this program as is and it is working for him. So, the only things that I can think of are the compiler version, the CFG files, and the passed parameters. Are you using an old C compiler? Are you using the Borland compiler? Are you sure the config files are setup correctly? Some things to think about.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Error with xbrowse-restorestate

Postby frose » Thu Nov 04, 2010 6:14 pm

Hi,

though the sample is working with the right value for <cState> my application crashes as described above!

I have no more idea what is going on :(
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Strange Error with xbrowse-restorestate

Postby James Bott » Thu Nov 04, 2010 7:17 pm

Frank,

As Gilbert discovered, some cState values are too large to be retrieved from an INI file, thus they are truncated. Gilbert has not yet been able to compile a revised C program to correct the problem. But, it will happen as soon as we can get some guidance from a C programmer.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Strange Error with xbrowse-restorestate

Postby frose » Thu Nov 04, 2010 7:30 pm

James,

thank you for your advice.

Just debugging xbrowse.prg till method KeyNo(), wondering that the value of <nGoTo> and also the code block <bKeyNo> is NIL!

So it's clear: a refresh is not suitable, because the browse isn't activated yet.

It's working now, only by commenting '::Refresh()' in the method 'RestoreState()'! :D
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 22 guests