Problem on Closing a form which has been edited

Discussion forum about all things Team Developer 5.x and 6.x
Samad Sodul
Mauritius
Posts: 24
Joined: 29 Aug 2018, 15:21
Location: Mauritius

Problem on Closing a form which has been edited

Post by Samad Sodul » 16 Mar 2019, 05:16

Hi
In TD2.0, I have a function (IFAnyEdit) which checks when a user closes a form window/Table Window which has been edited but not yet saved, a message is prompted 'If you quit, the record will not be saved'.

I have now converted my applications from TD2.0 to TD6.3. This function is not working in TD6.3. Can I have a solution ?

Thanks
Samad

Function: IFAnyEdit
Description:
Returns
Boolean:
Parameters
Static Variables
Local variables
Window Handle: hWndChild
Number: nType
Actions
Set hWndChild = SalGetFirstChild( hWndForm, TYPE_Any )
While hWndChild != hWndNULL
Set nType = SalGetType( hWndChild )
If nType = TYPE_ChildTable
If SalTblAnyRows( hWndChild, ROW_New | ROW_Edited | ROW_MarkDeleted, 0 )
Return TRUE
Else
If nType != TYPE_PushButton
If SalWindowIsDerivedFromClass( hWndChild, ICdfFilter) = FALSE AND
SalWindowIsDerivedFromClass( hWndChild, ICdfLookUpFilter) = FALSE AND
SalWindowIsDerivedFromClass( hWndChild, ICrbFilter) = FALSE AND
SalWindowIsDerivedFromClass( hWndChild, ICcmbFilter) = FALSE
If SalQueryFieldEdit( hWndChild )
Return TRUE
Set hWndChild = SalGetNextChild( hWndChild, TYPE_Any )
Return FALSE

FRBhote
India
Posts: 1321
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Problem on Closing a form which has been edited

Post by FRBhote » 16 Mar 2019, 06:12

Put breakpoints and edit table window, see what happens. Then do the same thing for pushbutton and see. And do on...

Samad Sodul
Mauritius
Posts: 24
Joined: 29 Aug 2018, 15:21
Location: Mauritius

Re: Problem on Closing a form which has been edited

Post by Samad Sodul » 16 Mar 2019, 07:37

I put breakpoint on the edited field.
The Sal function SalQueryFieldEdit(hWndChild ) does nothing in TD63.


pls help.

Samad Sodul
Mauritius
Posts: 24
Joined: 29 Aug 2018, 15:21
Location: Mauritius

Re: (Need help) Problem on Closing a form which has been edited

Post by Samad Sodul » 16 Mar 2019, 10:16

My problem is in the attached example.
Form window with a Tab(frm1) : Does not execute the exit check

Form window (frm2): It does the exit check


Thnks to revert

s.
You do not have the required permissions to view the files attached to this post.

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1232
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Problem on Closing a form which has been edited

Post by Dave Rabelink » 16 Mar 2019, 12:29

Hi Samad,

The issue is with the TabBar. This control has a different internal structure compared to the QuickTab control.

See this article:


https://wiki.tdcommunity.net/index.php/ ... ld_objects


So, when your code encounters a TabBar, you then need to drill down the tabpage layers to discover the child objects residing on each tabpage.

I changed your sample to handle the TabBar.

TESTEXIT_working.zip
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

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

Samad Sodul
Mauritius
Posts: 24
Joined: 29 Aug 2018, 15:21
Location: Mauritius

Re: Problem on Closing a form which has been edited

Post by Samad Sodul » 16 Mar 2019, 13:59

Dear Dave

You are great.

Thanks a lot for your help.

Regards

Samad

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests