Page 1 of 2
xbrowse command not working properly -- MR. RAO
Posted: Mon Feb 21, 2022 10:59 pm
by Compuin
Hello,
I am using the xbrowse command to add columns but it brings me empty the browse. My datasource is defined as follows
Code: Select all | Expand
cSql:= "SELECT * FROM MXCTAALM"
oTb:= TMSQuery():New( oAp:oMySql, cSql )
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
DATASOURCE oTb;
LINES CELL AUTOSORT
WITH OBJECT oBrw
:SetMySql( oTb, .F. ) // USAR .F.
:nHeaderLines := 1
:nFreeze := 0
:lHeader := .T.
:l2007 := .F.
:lFooter := .F.
:lHScroll := .T.
:nStretchCol := STRETCHCOL_LAST
:bClrHeader := {|| { 0, 14671839}}
:SetColor( nClrText, nClrPane1 )
:SetFont(oFont)
:bClrStd := {|| {nClrText, IIF( oBrw:KeyNo() % 2 == 0, nClrPane1, nClrPane2 ) } }
:bLDblClick := {|| Editar( oBrw, .F. ) }
:bChange := {|| MuestraRegis( oBrw, cMsg )}
END
oBrw:CreateFromCode()
oWnd:oClient = oBrw
convertir gif en imagenesIt is a table of 4 columns which it shows and 6 records which it shows but empty.
How do I resolve this incident?
Re: xbrowse command not working properly -- MR. RAO
Posted: Tue Feb 22, 2022 8:58 pm
by nageswaragunupudi
May I know what is the class TMSQuery? What library are you using? Please explain in detail.
Just like I do not know this class, XBrowse also does not know this class and so it can not help.
XBrowse can identify ADO Recordset, TDolphin, TMySql and FWH own mysql classes. (for mysql)
Please give us more details about the library and the class.
Re: xbrowse command not working properly -- MR. RAO
Posted: Tue Feb 22, 2022 9:06 pm
by Compuin
nageswaragunupudi wrote:May I know what is the class TMSQuery? What library are you using? Please explain in detail.
Just like I do not know this class, XBrowse also does not know this class and so it can not help.
XBrowse can identify ADO Recordset, TDolphin, TMySql and FWH own mysql classes. (for mysql)
Please give us more details about the library and the class.
It is an Eagle1 command to bring SQL results.
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 12:09 am
by nageswaragunupudi
I do not know the methods of this class. So xbrowse does not know.
Now, let us make this work.
Please let me know:
What are the methods to
1. GoTop (eg: oTb:GoTop() )
2. GoBottom
3. GoTo( nthRecord )
4. Bof()
5. Eof()
How do we access and assign field values?
Is it similar to other classes like
x := oTb:fieldname
oTb:fieldname := x
?
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 5:33 am
by Compuin
nageswaragunupudi wrote:I do not know the methods of this class. So xbrowse does not know.
Now, let us make this work.
Please let me know:
What are the methods to
1. GoTop (eg: oTb:GoTop() )
2. GoBottom
3. GoTo( nthRecord )
4. Bof()
5. Eof()
How do we access and assign field values?
Is it similar to other classes like
x := oTb:fieldname
oTb:fieldname := x
?
Thanks Mr Rao
Code: Select all | Expand
1.- GoTop -------> oTb:GoTop()
2.- GoBottom ---> oTb:GoBottom()
3.- Bof -----------> oTb:Bof()
4.- Eof -----------> oTb:Eof()
x:= oTb:FieldGet( nCol )
Let me know if you have any other concern
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 6:25 am
by nageswaragunupudi
Can I also assume that:
1. oTb:RecCount() --> number of rows?
2. oTb:RecNo() --> current row/record number?
3. oTb:GoTo( n ) --> Moves the record pointer to nth row?
4. oTb:Skip( +n or -n ) --> skips the record pointer by n or -n rows?
How did you define columns?
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 6:28 am
by Compuin
nageswaragunupudi wrote:Can I also assume that:
1. oTb:RecCount() --> number of rows?
2. oTb:RecNo() --> current row/record number?
3. oTb:GoTo( n ) --> Moves the record pointer to nth row?
4. oTb:Skip( +n or -n ) --> skips the record pointer by n or -n rows?
How did you define columns?
Yes, sir
For column in Browse
Code: Select all | Expand
oCol := oBrw:AddCol()
oCol:nWidth := 50
oCol:bEditValue := { ||oTb:FieldGet( 1 )}
oCol:cHeader := "Codigo "
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 6:58 am
by nageswaragunupudi
Good.
Please try
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
LINES CELL AUTOSORT
WITH OBJECT oBrw
:SetMySql( oTb, .F. ) // USAR .F.
// add one two columns
:CreateFromCode()
and let me know please.
I will be glad if you patiently help me to make xbrowse fully compatible with TMSQuery
Do these methods also work as expected?
fieldpos(), fieldname(), fieldlen(),fieldtype(),fielddec()
?
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 7:08 am
by Compuin
nageswaragunupudi wrote:Good.
Please try
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
LINES CELL AUTOSORT
WITH OBJECT oBrw
:SetMySql( oTb, .F. ) // USAR .F.
// add one two columns
:CreateFromCode()
and let me know please.
I will be glad if you patiently help me to make xbrowse fully compatible with TMSQuery
Do these methods also work as expected?
fieldpos(), fieldname(), fieldlen(),fieldtype(),fielddec()
?
MR Rao, in this way works Ok
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
LINES CELL AUTOSORT
WITH OBJECT oBrw
:SetMySql( oTb, .F. ) // USAR .F.
:nHeaderLines := 1
:nFreeze := 0
:lHeader := .T.
:l2007 := .F.
:lFooter := .F.
:lHScroll := .T.
:nStretchCol := STRETCHCOL_LAST
:bClrHeader := {|| { 0, 14671839}}
:SetColor( nClrText, nClrPane1 )
:SetFont(oFont)
:bClrStd := {|| {nClrText, IIF( oBrw:KeyNo() % 2 == 0, nClrPane1, nClrPane2 ) } }
:bLDblClick := {|| Editar( oBrw, .F. ) }
:bChange := {|| MuestraRegis( oBrw, cMsg )}
oCol := oBrw:AddCol()
oCol:nWidth := 50
oCol:bEditValue := { ||oTb:FieldGet( 1 )}
oCol:cHeader := "Codigo "
oCol := oBrw:AddCol()
oCol:nWidth := 150
oCol:bEditValue := { ||oTb:FieldGet( 2 )}
oCol:cHeader := "Nombre "
END
oBrw:CreateFromCode()
But not for this one
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
COLUMS 1, 2;
LINES CELL AUTOSORT
oBrw:SetMySql( oTb, .F. ) // USAR .F.
oBrw:CreateFromCode()
Do these methods also work as expected?
fieldpos(), fieldname(), fieldlen(),fieldtype(),fielddec()
?
Yes, these method work Ok as well
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 7:48 am
by nageswaragunupudi
Does oTb:FieldGet( cFieldName ) work?
Are you using FWH2012 ?
If so, try making the following modifications to xbrowse.prg and include in your link script.
Replace line 1297
Code: Select all | Expand
elseif ! Empty( ::oMysql ) .AND. ::oMysql:IsKindOf( 'TMYSQLQUERY' )
WITH
Code: Select all | Expand
elseif ! Empty( ::oMysql ) .AND. ( ::oMysql:IsKindOf( 'TMYSQLQUERY' ) .or. ::oMySql:IsKindOf( 'TMSQUERY' ) )
Replace Line: 17327
WITH
Code: Select all | Expand
if uDataSrc:IsKindOf( 'TMYSQLQUERY' ) .or. uDataSrc:IsKindOf( 'TMSQUERY' )
Now, please try
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
DATASOURCE oTb ;
COLUMS "Codigo", "Nombre" ;
LINES CELL // AUTOSORT
// oBrw:SetMySql( oTb, .F. ) // USAR .F. // remove this
oBrw:CreateFromCode()
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 8:03 am
by Compuin
nageswaragunupudi wrote:Does oTb:FieldGet( cFieldName ) work?
Are you using FWH2012 ?
If so, try making the following modifications to xbrowse.prg and include in your link script.
Replace line 1297
Code: Select all | Expand
elseif ! Empty( ::oMysql ) .AND. ::oMysql:IsKindOf( 'TMYSQLQUERY' )
WITH
Code: Select all | Expand
elseif ! Empty( ::oMysql ) .AND. ( ::oMysql:IsKindOf( 'TMYSQLQUERY' ) .or. ::oMySql:IsKindOf( 'TMSQUERY' ) )
Replace Line: 17327
WITH
Code: Select all | Expand
if uDataSrc:IsKindOf( 'TMYSQLQUERY' ) .or. uDataSrc:IsKindOf( 'TMSQUERY' )
Now, please try
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
DATASOURCE oTb ;
COLUMS "Codigo", "Nombre" ;
LINES CELL // AUTOSORT
// oBrw:SetMySql( oTb, .F. ) // USAR .F. // remove this
oBrw:CreateFromCode()
Hello Mr. Rao,
Changes on XBrowse.prg were made.
I got this error
Application Internal Error - C:\clinica32\Clinica32.exe
Terminated at: 2022-02-23 03:06:36
Unrecoverable error 6005: Exception error:
Exception Code:C0000005 ACCESS_VIOLATION
Exception Address:0015EBEA
EAX:004A5C08 EBX:00252005 ECX:004CE043 EDX:00000043
ESI:00000000 EDI:00000006 EBP:002929E1
CS:EIP:0023:0015EBEA SS:ESP:002B:00CFF7E0
DS:002B ES:002B FS:0053 GS:002B
Flags:00010206
Exception Parameters: 00000001 00252005
CS:EIP: 88 0C 1E 46 3B F7 72 EE 5F 5E 8B C3 5B C3 85 FF
SS:ESP: 01277654 02CC6BA4 00000000 0009A5E4 00252005 00000006 01277654 002929E1 00000000 00000000 00141C0D 000000AF 00000002 01258234 00000000 00000000
C stack:
EIP: EBP: Frame: OldEBP, RetAddr, Params...
Modules:
00090000 00479000 C:\clinica32\Clinica32.exe
77B80000 001A3000 C:\Windows\SYSTEM32\ntdll.dll
768D0000 000F0000 C:\Windows\System32\KERNEL32.DLL
769D0000 00214000 C:\Windows\System32\KERNELBASE.dll
759B0000 0009F000 C:\Windows\SYSTEM32\apphelp.dll
7BAC0000 003E6000 C:\clinica32\LIBMYSQL.dll
75F40000 0019C000 C:\Windows\System32\USER32.dll
77A40000 00018000 C:\Windows\System32\win32u.dll
754A0000 00008000 C:\Windows\SYSTEM32\VERSION.dll
76D30000 00024000 C:\Windows\System32\GDI32.dll
76BF0000 000BF000 C:\Windows\System32\msvcrt.dll
764C0000 000DC000 C:\Windows\System32\gdi32full.dll
75B10000 0007B000 C:\Windows\System32\ADVAPI32.dll
75BE0000 0007B000 C:\Windows\System32\msvcp_win.dll
75D50000 00120000 C:\Windows\System32\ucrtbase.dll
767C0000 00076000 C:\Windows\System32\sechost.dll
75E80000 000BE000 C:\Windows\System32\RPCRT4.dll
76840000 00063000 C:\Windows\System32\WS2_32.dll
76710000 000AF000 C:\Windows\System32\COMDLG32.dll
77320000 00280000 C:\Windows\System32\combase.dll
75C60000 00087000 C:\Windows\System32\shcore.dll
63450000 0002C000 C:\Windows\SYSTEM32\oledlg.dll
76470000 00045000 C:\Windows\System32\SHLWAPI.dll
760F0000 000E3000 C:\Windows\System32\ole32.dll
76D60000 005B5000 C:\Windows\System32\SHELL32.dll
762D0000 00096000 C:\Windows\System32\OLEAUT32.dll
70890000 00028000 C:\Windows\SYSTEM32\WINMM.dll
758F0000 000A3000 C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9625_none_508ef7e4bcbbe589\MSVCR90.dll
759A0000 0000A000 C:\Windows\SYSTEM32\Secur32.dll
632E0000 00167000 C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.1566_none_d951c72fe1040d0f\gdiplus.dll
70810000 00072000 C:\Windows\SYSTEM32\WINSPOOL.DRV
70C10000 00210000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_a8625c1886757984\COMCTL32.dll
708C0000 00006000 C:\Windows\SYSTEM32\MSIMG32.dll
58720000 0001A000 C:\Windows\SYSTEM32\MPR.dll
75730000 00021000 C:\Windows\SYSTEM32\SSPICLI.DLL
77A60000 00025000 C:\Windows\System32\IMM32.DLL
703B0000 00074000 C:\Windows\system32\uxtheme.dll
77A90000 000D4000 C:\Windows\System32\MSCTF.dll
68390000 00094000 C:\Windows\SYSTEM32\TextShaping.dll
75650000 0000F000 C:\Windows\SYSTEM32\kernel.appcore.dll
775A0000 0005F000 C:\Windows\System32\bcryptPrimitives.dll
6C600000 000B9000 C:\Windows\SYSTEM32\textinputframework.dll
68C00000 0027E000 C:\Windows\System32\CoreUIComponents.dll
6C560000 0009B000 C:\Windows\System32\CoreMessaging.dll
6CB20000 000DB000 C:\Windows\SYSTEM32\wintypes.dll
70900000 00029000 C:\Windows\SYSTEM32\ntmarta.dll
75530000 00011000 C:\Windows\system32\napinsp.dll
754B0000 00016000 C:\Windows\system32\pnrpnsp.dll
75490000 00010000 C:\Windows\system32\wshbth.dll
74CB0000 00016000 C:\Windows\system32\NLAapi.dll
74C70000 00032000 C:\Windows\SYSTEM32\IPHLPAPI.DLL
754D0000 00052000 C:\Windows\System32\mswsock.dll
74BE0000 00090000 C:\Windows\SYSTEM32\DNSAPI.dll
760E0000 00007000 C:\Windows\System32\NSI.dll
736F0000 0000E000 C:\Windows\System32\winrnr.dll
71420000 00008000 C:\Windows\System32\rasadhlp.dll
Called from E1FIELDPOS(0)
Called from TMSQUERY:FIELDPOS(496) in source\prg\msquery.prg
Called from TXBROWSE:SETCOLFROMMYSQL(7313) in source\xbrowse.prg
Called from TXBROWSE:SETMYSQL(6686) in source\xbrowse.prg
Called from XBRWSETDATASOURCE(17333) in source\xbrowse.prg
Called from XBROWSENEW(17096) in source\xbrowse.prg
Called from MXCTAALM(60) in source\Mxctaalm.prg
Called from (b)CLINICA32WIN(69) in source\Clinica32win.prg
Called from TBTNBMP:CLICK(713) in .\source\classes\BTNBMP.PRG
Called from TBTNBMP:LBUTTONUP(999) in .\source\classes\BTNBMP.PRG
Called from TCONTROL:HANDLEEVENT(1817) in .\source\classes\CONTROL.PRG
Called from TBTNBMP:HANDLEEVENT(2051) in .\source\classes\BTNBMP.PRG
Called from _FWH(3559) in .\source\classes\WINDOW.PRG
Called from WINRUN(0)
Called from TMDIFRAME:ACTIVATE(1097) in .\source\classes\WINDOW.PRG
Called from CLINICA32WIN(138) in source\Clinica32win.prg
Called from MAIN(6) in source\Clinica32.prg
------------------------------------------------------------------------
Line TMSQUERY:FIELDPOS(496)
Code: Select all | Expand
//---------------------------------------------------------------------------//
// Orden de la columna en el registro
METHOD FieldPos( cCol ) CLASS TMSQuery
return( E1FieldPos( ::hMySQL, cCol ) )
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 10:50 am
by nageswaragunupudi
So the problem is with TMSQeuery's FieldPos() method.
You need to resolve this error with the authors.
To make sure, please directly test
It is better you check all other methods I mentioned above.
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 10:53 am
by nageswaragunupudi
In the meantime try
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
DATASOURCE oTb ;
COLUMS 1,2 ;
HEADERS "CODIGO", "NOMBRE" ;
LINES CELL
oBrw:CreateFromCode()
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 2:24 pm
by Compuin
nageswaragunupudi wrote:In the meantime try
Code: Select all | Expand
@ 0,0 XBROWSE oBrw OF oWnd ;
DATASOURCE oTb ;
COLUMS 1,2 ;
HEADERS "CODIGO", "NOMBRE" ;
LINES CELL
oBrw:CreateFromCode()
I fixed the problem on FieldPos().
Now I get this
Called from E1FIELDGET(0)
Called from TMSQUERY:FIELDGET(639) in source\prg\msquery.prg
Called from MXCTAALM(26) in source\Mxctaalm.prg
Called from (b)CLINICA32WIN(69) in source\Clinica32win.prg
Called from TBTNBMP:CLICK(713) in .\source\classes\BTNBMP.PRG
Called from TBTNBMP:LBUTTONUP(999) in .\source\classes\BTNBMP.PRG
Called from TCONTROL:HANDLEEVENT(1817) in .\source\classes\CONTROL.PRG
Called from TBTNBMP:HANDLEEVENT(2051) in .\source\classes\BTNBMP.PRG
Called from _FWH(3559) in .\source\classes\WINDOW.PRG
Called from WINRUN(0)
Called from TMDIFRAME:ACTIVATE(1097) in .\source\classes\WINDOW.PRG
Called from CLINICA32WIN(138) in source\Clinica32win.prg
Called from MAIN(6) in source\Clinica32.prg
------------------------------------------------------------------------
Silly question , for xbrowse class, FieldGet is character or number? Same for FieldName data type??
Thanks again
Re: xbrowse command not working properly -- MR. RAO
Posted: Wed Feb 23, 2022 4:53 pm
by nageswaragunupudi
In the XBrowse.prg, Line no:7371
Code: Select all | Expand
DEFAULT oCol:bEditValue := { |x| If( x == nil, ::oMySql:FieldGet( cName ), ::oMySql:FieldPut( nCol, x ) ) }
Change this as:
Code: Select all | Expand
if ::oMySql:IsKindOf( "TMSQUERY" )
DEFAULT oCol:bEditValue := { |x| If( x == nil, ::oMySql:FieldGet( nCol ), ::oMySql:FieldPut( nCol, x ) ) }
else
DEFAULT oCol:bEditValue := { |x| If( x == nil, ::oMySql:FieldGet( cName ), ::oMySql:FieldPut( nCol, x ) ) }
endif