Dear Gupta Team,
We are passing Named toolbar handle into APD through user defined events. The application is crashing if I use the SalTBdisableItem(). However, It works If i try to use another Named toolbar function such as SalTbSetItemText().
I have tried couple of other ways too but application crashes.
Attached is the sample application without commenting SalTbSetItemText(). The application changes the text to "Dynamic".
The SalTBDisableItem() is currently commented and uncommenting this function will lead into application crashes.
This is tested in TD 6.2 SP1 in Windows 7 and Windows 8 with SQL Server 2008 R2
Three files are attached. LIB.APL, Sam.APT ( build this as APD) and Main.APT ( run this application to check)
Please let us know if there is any work around to resolve.
Thanks.
Regards,
Siva A.
App crashes if disabling Named TB btn over Dynalib
App crashes if disabling Named TB btn over Dynalib
You do not have the required permissions to view the files attached to this post.
-
- Founder/Site Admin
- Posts: 3522
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: App crashes if disabling Named TB btn over Dynalib
Hi Siva,
Yes, I have a workaround for you.
Basically, you pass the current context (within the main application) to the dynalib which is used there to execute specific code within the main application.
So at Main side, you pass the window handle AND the context as message to the dynalib:
Then at dynalib side:
It is clearly a bug that the windowhandle can not be used on SalTBDisableItem in a dynalib context.
I have seen some other Sal functions fail, like here. This trick solves those issues.
Attached the change source:
Yes, I have a workaround for you.
Basically, you pass the current context (within the main application) to the dynalib which is used there to execute specific code within the main application.
So at Main side, you pass the window handle AND the context as message to the dynalib:
Code: Select all
On SAM_TabChange
! Pass current context as wParam
Call SalSendMsg ( hWndForms[lParam], AM_Activate, SalHStringToNumber( SalContextCurrent( ) ) , SalWindowHandleToNumber(hWndTBCRUD) )
Code: Select all
On AM_Activate
! wParam = context
! lParam = window handle
Call OnActivate( SalNumberToHString( wParam ), SalNumberToWindowHandle (lParam) )
Function: OnActivate
! Create evaluation string
Set sWindowHandle = SalNumberToStrX( SalWindowHandleToNumber( hWndTBCRUD ), 0 )
Set sIndex = SalNumberToStrX( 0, 0 )
Set sEval = "SalTBDisableItem( SalNumberToWindowHandle( " || sWindowHandle || " ), " || sIndex || " )"
!
Call SalCompileAndEvaluate( sEval, nError, nErrorPos, nNumber, sString, dtDate, hWndWindow, TRUE, psContext )
It is clearly a bug that the windowhandle can not be used on SalTBDisableItem in a dynalib context.
I have seen some other Sal functions fail, like here. This trick solves those issues.
Attached the change source:
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: App crashes if disabling Named TB btn over Dynalib
Dear Dave,
Thanks a lot for your response and I have tested this and it works fine as per expectation. I am wondering or afraid about how many SAL functions are like that.
One more thing,
This is working fine in win32 architecture but I tried to test this in WPF Desktop but no effect.
I would require to do this since my end state of my product is going to be in XBAP browser.
Thank you once again.
and it would be great if you could share SAL functions which will create problems.
thanks
Regards,
Siva A
Thanks a lot for your response and I have tested this and it works fine as per expectation. I am wondering or afraid about how many SAL functions are like that.
One more thing,
This is working fine in win32 architecture but I tried to test this in WPF Desktop but no effect.
I would require to do this since my end state of my product is going to be in XBAP browser.
Thank you once again.
and it would be great if you could share SAL functions which will create problems.
thanks
Regards,
Siva A
Who is online
Users browsing this forum: [Ccbot] and 1 guest