Page 3 of 4

Re: Browse of my ADO Class

Posted: Thu Oct 10, 2024 5:02 am
by Antonio Linares
Dear Jose,

We have tested your hwgui example and we have found that dialogs can't be closed unless you close them in a specific (built?) order.
Unless you close the latest shown dialog, the others can't be closed.

You can download the built example from here:
https://github.com/FiveTechSoft/FWH_too ... gboxes.exe

source code:

Code: Select all | Expand

#include "hwgui.ch"

static n := 1

FUNCTION Main()

   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadWaitForAll()
*
   RETURN Nil

FUNCTION Main2()

   LOCAL oDlg

   INIT DIALOG oDlg TITLE Str( n++ ) ;
     AT 200,0 SIZE 400,150

   ACTIVATE DIALOG oDlg

   RETURN Nil
continued in next post...

Re: Browse of my ADO Class

Posted: Thu Oct 10, 2024 5:15 am
by Antonio Linares
Using your example as a guide, we have detected and fixed where FWH was failing.

I am emailing you the modified FWH libs for bcc77. Please let me know if you need them for MSVC too.
Please confirm me that you get them, thanks.

Still it seems as we have something to fix when closing the dialogs. Sometimes they stop responding, still not sure why.
We can close them in any order, but sometimes they stop responding after closing a dialog. Searching for this...

We do appreciate your great feedback on this :-)

Re: Browse of my ADO Class

Posted: Thu Oct 10, 2024 5:35 am
by Antonio Linares
Ok, we found it. It was the call to the garbage collector from Class TDialog Method End()

The solution is to call hb_gcAll( .F. ) :-)

Now it is working perfectly! :-) You can close the dialogs in any order (something not possible with Alexander's lib)

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadStart( { || Main2() } )
   hb_ThreadWaitForAll()

return nil

function Main2()

   local oDlg

   static nDlg := 1

   DEFINE DIALOG oDlg SIZE 400, 300 TITLE Str( nDlg++ )

   ACTIVATE DIALOG oDlg CENTERED

return nil

Re: Browse of my ADO Class

Posted: Thu Oct 10, 2024 7:23 am
by Enrico Maria Giordano
Antonio,

I'm trying to test your sample, but the program just end without any error or crash. What am I missing?

Re: Browse of my ADO Class

Posted: Thu Oct 10, 2024 7:38 am
by Antonio Linares
Dear Enrico,

You have to build it this way: (Harbour's multithread support)

samples\buildhmt.bat multi

Re: Browse of my ADO Class

Posted: Thu Oct 10, 2024 8:15 am
by Enrico Maria Giordano
Ok, hbvmmt.lib, thank you.

Re: Browse of my ADO Class

Posted: Sun Oct 13, 2024 3:15 am
by JoséQuintas
Antonio Linares wrote:You can close the dialogs in any order (something not possible with Alexander's lib)
It is possible too, using an extra parameter when building library.

2021-10-31 04:50 UTC-0300 Jose Quintas
! source/winapi/hdialog.prg
! source/winapi/hwindow.prg
! Small change for multithread
Each thread will have it's own dialog and window list
activated only if compile using -DMT_EXPERIMENTAL
No change if do not compile using this parameter



Is this change on fivewin?

Code: Select all | Expand

METHOD End( nResult ) CLASS TDialog
   ...
   SysRefresh()
   hb_gcAll(.F.)         // Garbage collector

   return .T.
 

Code: Select all | Expand

test2.prg
dialog.prg
fivewin.hbc
-mt
 
No change for multithread.

Re: Browse of my ADO Class

Posted: Sun Oct 13, 2024 4:03 am
by Antonio Linares
Jose,

> It is possible too, using an extra parameter when building library

very good

> Is this change on fivewin?

Yes, included in the libs that I have sent you

Re: Browse of my ADO Class

Posted: Sun Oct 13, 2024 4:31 am
by JoséQuintas
Antonio Linares wrote:Yes, included in the libs that I have sent you
Where I can found them ?

Re: Browse of my ADO Class

Posted: Sun Oct 13, 2024 4:59 am
by Antonio Linares
I sent them to your email

Re: Browse of my ADO Class

Posted: Sun Oct 13, 2024 2:29 pm
by JoséQuintas
At momment no email.
I already check all folders including spam and deleted.

Re: Browse of my ADO Class

Posted: Sun Oct 13, 2024 5:10 pm
by Antonio Linares
Please send me a whatsapp msg to +34 722461100

thanks!

Re: Browse of my ADO Class

Posted: Mon Oct 14, 2024 10:56 am
by JoséQuintas
Image

working with multithread.
On menu

Code: Select all | Expand

MENUITEM cDBF ACTION hb_ThreadStart( { || frm_funcMain( cDBF, aAllSetup,.T. ) } )
 
On dialogs: USE DBCLIENT ... CLOSE DATABASES
On all dialogs: click NEXT does a SKIP, and moves from 1 to 2
OK, this is multithread, each dialog have it's own dbf

WITHOUT multithread:
dialog 1: click next, does a skip, and moves from 1 to 2
dialog 2: click next, does a skip, and moves from 1 to 3
dialog 3: click next, does a skip, and moves from 1 to 4
dialog 4: click next, does a skip, and moves from 1 to 5
Ok, it is not multithread, all dialogs uses same dbf, and SKIP on same dbf.

No classes, no extra controls, basic USE/CLOSE.., and multithread.
Any dialog can call another routine, and current record will be the correct record.
No matter if change order, apply filter, or anything else on each thread.
Multithread is the same as several EXEs.
One thread/EXE does not change another.

Many thanks.

Re: Browse of my ADO Class

Posted: Mon Oct 14, 2024 11:29 am
by Antonio Linares
great work, excellent! :-)

Re: Browse of my ADO Class

Posted: Wed Dec 18, 2024 4:54 pm
by JoséQuintas
As a comment:
on FW 24.10 I do not have same result with multithread.
May be when mixed with GTWVG can't be same solution for normal use.
No problem, I continue with FW 24.09


An error today (FW 24.09):
Memory:4.00 GB
Mem.VM:3.80 GB
Windows: Windows 10 10.0.19045
Harbour: Harbour 3.2.0dev (r2412130806)
Compiler: MinGW GNU C 14.2 (32-bit)
GT: WVG

Error BASE/1068 Argument error: array access
Called from (b)FWDELRESOURCE(0)
Called from ASCAN(0)
Called from FWDELRESOURCE(0)
Called from DELETEOBJECT(0)
Called from FILLRECTEX(0)
Called from FW_SAYTEXT(0)
Called from TXBRWCOLUMN:PAINTBMPANDTEXT(14494)
Called from TXBRWCOLUMN:PAINTHEADER(14604)
Called from TXBROWSE:PAINTHEADER(2885)
Called from TXBROWSE:PAINT(2402)
Called from TXBROWSE:DISPLAY(2221)
Called from TCONTROL:HANDLEEVENT(0)
Called from TXBROWSE:HANDLEEVENT(12558)
Called from _FWH(0)
Called from DIALOGBOXINDIRECT(0)
Called from TDIALOG:ACTIVATE(0)
Called from FWBROWSEADO(93)
Called from (b)BROWSEADO(180)
(1) = Tipo: U
(2) = Tipo: N Valor: 2
Not sure if this is the best solution, but I changed fivewin/function/checkres.prg

changed from

Code: Select all | Expand

static aResources := {}
 
changed to

Code: Select all | Expand

thread static aResources := {}
 
On this way, each thread have it's own aResources.
Seems Ok now.