Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How to determine if a DataWindow is dirty (has been modified)?

12 posts in DataWindow Last posting was on 2009-11-05 17:24:54.0Z
@maram Posted on 2009-11-02 22:08:28.0Z
From: "@maram" <atmaram.mulliah@gmail.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: How to determine if a DataWindow is dirty (has been modified)?
Date: Mon, 2 Nov 2009 14:08:28 -0800 (PST)
Organization: http://groups.google.com
Lines: 27
Message-ID: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com>
NNTP-Posting-Host: 86.43.69.25
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1257199708 3976 127.0.0.1 (2 Nov 2009 22:08:28 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 2 Nov 2009 22:08:28 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f16g2000yqm.googlegroups.com; posting-host=86.43.69.25; posting-account=4TPDNwoAAAAfSrSLl7b_4Q-210Mp0Cy7
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!f16g2000yqm.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90198
Article PK: 409805

Hi all,

I have a small question regarding DW.

I have a window open in an MDI and the window contains a couple of DWs
both of which are updatable.
Now, when the user tries to close the window, I would like to
determine if the Window (i.e., DWs are dirty or have been modified)
and prompt the user to "save the changes or close anyway?".

I have implemented this by doing the "modifiedcount() + deletedcount()
> 0" stuff. This does NOT work because prior to this, I've got to do
accepttext(). The problem with accepttext() is that it triggers error
messages in ItemError event of the DW. I don't want to perform
validation. I just want to determine if the DW has been modified or
not.

Can any one pls let me know whether what am trying to achieve is
doable or not?

The biggest part has been done but this piece is missing and without
it, the whole application looks incomplete.

Thanking you in advance for your time.

Best,
-A


Arthur Hefti Posted on 2009-11-03 04:33:13.0Z
From: "Arthur Hefti" <arthur@catsoft.ch>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com>
User-Agent: XanaNews/1.19.1.194
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4aefb289$1@forums-1-dub>
Date: 2 Nov 2009 20:33:13 -0800
X-Trace: forums-1-dub 1257222793 10.22.241.152 (2 Nov 2009 20:33:13 -0800)
X-Original-Trace: 2 Nov 2009 20:33:13 -0800, vip152.sybase.com
Lines: 34
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90200
Article PK: 409804

You can prevent the error message in the ItemError event by returning 2
at the end. See the help for more details.

Arthur

@maram wrote:

> Hi all,
>
> I have a small question regarding DW.
>
> I have a window open in an MDI and the window contains a couple of DWs
> both of which are updatable.
> Now, when the user tries to close the window, I would like to
> determine if the Window (i.e., DWs are dirty or have been modified)
> and prompt the user to "save the changes or close anyway?".
>
> I have implemented this by doing the "modifiedcount() + deletedcount()
> > 0" stuff. This does NOT work because prior to this, I've got to do
> accepttext(). The problem with accepttext() is that it triggers error
> messages in ItemError event of the DW. I don't want to perform
> validation. I just want to determine if the DW has been modified or
> not.
>
> Can any one pls let me know whether what am trying to achieve is
> doable or not?
>
> The biggest part has been done but this piece is missing and without
> it, the whole application looks incomplete.
>
> Thanking you in advance for your time.
>
> Best,
> -A


@maram Posted on 2009-11-03 10:10:54.0Z
From: "@maram" <atmaram.mulliah@gmail.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Date: Tue, 3 Nov 2009 02:10:54 -0800 (PST)
Organization: http://groups.google.com
Lines: 48
Message-ID: <bf2bd653-2409-41b4-96dc-4b06e9903133@l2g2000yqd.googlegroups.com>
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4aefb289$1@forums-1-dub>
NNTP-Posting-Host: 86.43.69.25
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1257243054 15957 127.0.0.1 (3 Nov 2009 10:10:54 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 3 Nov 2009 10:10:54 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: l2g2000yqd.googlegroups.com; posting-host=86.43.69.25; posting-account=4TPDNwoAAAAfSrSLl7b_4Q-210Mp0Cy7
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!l2g2000yqd.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90202
Article PK: 409807

Hi Arthur,

Thanks for your response.

That's true what you said. However, I have validation messages in the
ItemError event, so I can't just return 2....I have to return 1 in
some cases (CHOOSE-CASE-ELSE).

Thanks again Arthur, any other ideas?

Best regards,
-A

On Nov 3, 4:33 am, "Arthur Hefti" <art...@catsoft.ch> wrote:
> You can prevent the error message in the ItemError event by returning 2
> at the end. See the help for more details.
>
> Arthur
>
> @maram wrote:
> > Hi all,
>
> > I have a small question regarding DW.
>
> > I have a window open in an MDI and the window contains a couple of DWs
> > both of which are updatable.
> > Now, when the user tries to close the window, I would like to
> > determine if the Window (i.e., DWs are dirty or have been modified)
> > and prompt the user to "save the changes or close anyway?".
>
> > I have implemented this by doing the "modifiedcount() + deletedcount()
> > > 0" stuff. This does NOT work because prior to this, I've got to do
> > accepttext(). The problem with accepttext() is that it triggers error
> > messages in ItemError event of the DW. I don't want to perform
> > validation. I just want to determine if the DW has been modified or
> > not.
>
> > Can any one pls let me know whether what am trying to achieve is
> > doable or not?
>
> > The biggest part has been done but this piece is missing and without
> > it, the whole application looks incomplete.
>
> > Thanking you in advance for your time.
>
> > Best,
> > -A


Ivaylo Ivanov Posted on 2009-11-03 11:10:05.0Z
From: "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af00f8d@forums-1-dub>
Date: 3 Nov 2009 03:10:05 -0800
X-Trace: forums-1-dub 1257246605 10.22.241.152 (3 Nov 2009 03:10:05 -0800)
X-Original-Trace: 3 Nov 2009 03:10:05 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90203
Article PK: 409811

Define boolean instance variable to track if something has been modified
since the last form retrieval.

boolean ib_modified = FALSE

Then set this variable to TRUE on all editable DWs' EditChanged and
ItemChanged events. Also, turn it to TRUE in the scripts where InsertRow,
SetItem or DeleteRow is issued upon some of these DWs.

Set the variable to FALSE after successful Save (meaning Update() for all
DWs + Commit) or Retrieve().

So the rest is to check this variable on CloseQuery.

HTH,
Ivaylo

"@maram" <atmaram.mulliah@gmail.com> wrote in message
news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
> Hi all,
>
> I have a small question regarding DW.
>
> I have a window open in an MDI and the window contains a couple of DWs
> both of which are updatable.
> Now, when the user tries to close the window, I would like to
> determine if the Window (i.e., DWs are dirty or have been modified)
> and prompt the user to "save the changes or close anyway?".
>
> I have implemented this by doing the "modifiedcount() + deletedcount()
>> 0" stuff. This does NOT work because prior to this, I've got to do
> accepttext(). The problem with accepttext() is that it triggers error
> messages in ItemError event of the DW. I don't want to perform
> validation. I just want to determine if the DW has been modified or
> not.
>
> Can any one pls let me know whether what am trying to achieve is
> doable or not?
>
> The biggest part has been done but this piece is missing and without
> it, the whole application looks incomplete.
>
> Thanking you in advance for your time.
>
> Best,
> -A


@maram Posted on 2009-11-03 11:50:26.0Z
From: "@maram" <atmaram.mulliah@gmail.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Date: Tue, 3 Nov 2009 03:50:26 -0800 (PST)
Organization: http://groups.google.com
Lines: 61
Message-ID: <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com>
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub>
NNTP-Posting-Host: 86.43.69.25
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1257249026 8448 127.0.0.1 (3 Nov 2009 11:50:26 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 3 Nov 2009 11:50:26 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: b15g2000yqd.googlegroups.com; posting-host=86.43.69.25; posting-account=4TPDNwoAAAAfSrSLl7b_4Q-210Mp0Cy7
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!b15g2000yqd.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90204
Article PK: 409808

Hi Ivaylo,

Thank you for your response.

Your point seems clear to me; let me go and put it in action and get
back to you with the results.

Best regards,
-A

On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>

wrote:
> Define boolean instance variable to track if something has been modified
> since the last form retrieval.
>
> boolean ib_modified = FALSE
>
> Then set this variable to TRUE on all editable DWs' EditChanged and
> ItemChanged events. Also, turn it to TRUE in the scripts where InsertRow,
> SetItem or DeleteRow is issued upon some of these DWs.
>
> Set the variable to FALSE after successful Save (meaning Update() for all
> DWs + Commit) or Retrieve().
>
> So the rest is to check this variable on CloseQuery.
>
> HTH,
> Ivaylo
>
> "@maram" <atmaram.mull...@gmail.com> wrote in message
>
> news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>
> > Hi all,
>
> > I have a small question regarding DW.
>
> > I have a window open in an MDI and the window contains a couple of DWs
> > both of which are updatable.
> > Now, when the user tries to close the window, I would like to
> > determine if the Window (i.e., DWs are dirty or have been modified)
> > and prompt the user to "save the changes or close anyway?".
>
> > I have implemented this by doing the "modifiedcount() + deletedcount()
> >> 0" stuff. This does NOT work because prior to this, I've got to do
> > accepttext(). The problem with accepttext() is that it triggers error
> > messages in ItemError event of the DW. I don't want to perform
> > validation. I just want to determine if the DW has been modified or
> > not.
>
> > Can any one pls let me know whether what am trying to achieve is
> > doable or not?
>
> > The biggest part has been done but this piece is missing and without
> > it, the whole application looks incomplete.
>
> > Thanking you in advance for your time.
>
> > Best,
> > -A


Jeremy Lakeman Posted on 2009-11-03 12:58:25.0Z
From: Jeremy Lakeman <jeremy.lakeman@gmail.com>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Date: Tue, 3 Nov 2009 04:58:25 -0800 (PST)
Organization: http://groups.google.com
Lines: 94
Message-ID: <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com>
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com>
NNTP-Posting-Host: 219.90.186.150
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1257253105 27935 127.0.0.1 (3 Nov 2009 12:58:25 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 3 Nov 2009 12:58:25 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: o9g2000prg.googlegroups.com; posting-host=219.90.186.150; posting-account=euaBtgoAAAC_vDxfsxmpMKlBxHaHpmRS
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!o9g2000prg.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90205
Article PK: 409809


On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
> Hi Ivaylo,
>
> Thank you for your response.
>
> Your point seems clear to me; let me go and put it in action and get
> back to you with the results.
>
> Best regards,
> -A
>
> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
> wrote:
>
> > Define boolean instance variable to track if something has been modified
> > since the last form retrieval.
>
> > boolean ib_modified = FALSE
>
> > Then set this variable to TRUE on all editable DWs' EditChanged and
> > ItemChanged events. Also, turn it to TRUE in the scripts where InsertRow,
> > SetItem or DeleteRow is issued upon some of these DWs.
>
> > Set the variable to FALSE after successful Save (meaning Update() for all
> > DWs + Commit) or Retrieve().
>
> > So the rest is to check this variable on CloseQuery.
>
> > HTH,
> > Ivaylo
>
> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>
> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>
> > > Hi all,
>
> > > I have a small question regarding DW.
>
> > > I have a window open in an MDI and the window contains a couple of DWs
> > > both of which are updatable.
> > > Now, when the user tries to close the window, I would like to
> > > determine if the Window (i.e., DWs are dirty or have been modified)
> > > and prompt the user to "save the changes or close anyway?".
>
> > > I have implemented this by doing the "modifiedcount() + deletedcount()
> > >> 0" stuff. This does NOT work because prior to this, I've got to do
> > > accepttext(). The problem with accepttext() is that it triggers error
> > > messages in ItemError event of the DW. I don't want to perform
> > > validation. I just want to determine if the DW has been modified or
> > > not.
>
> > > Can any one pls let me know whether what am trying to achieve is
> > > doable or not?
>
> > > The biggest part has been done but this piece is missing and without
> > > it, the whole application looks incomplete.
>
> > > Thanking you in advance for your time.
>
> > > Best,
> > > -A

Better (perhaps);

instance vars;
boolean ib_suppress_errors=false

closequery;
ib_suppress_errors=true
ll_valid = dw_1.accepttext()
ib_suppress_errors=false

if ll_valid <>1 then
if messagebox('...','... validation errors ... Do you want to close
anyway?',question!,yesno!) = 1 then return 0
return 1
end if

if modifiedcount() +
...


event itemerror();
if ib_supress_errors then return 1

...


Ivaylo Ivanov Posted on 2009-11-03 14:07:26.0Z
From: "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com> <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 99
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af0391e$1@forums-1-dub>
Date: 3 Nov 2009 06:07:26 -0800
X-Trace: forums-1-dub 1257257246 10.22.241.152 (3 Nov 2009 06:07:26 -0800)
X-Original-Trace: 3 Nov 2009 06:07:26 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90207
Article PK: 409813

Hi, Jerry

I don't think any AcceptText() and validation logic must be issued on a
window close at all, unless you have some Save logic there which is a
different (means "strange" <g>) interface decision, IMHO.

"Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
news:9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com...

On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
> Hi Ivaylo,
>
> Thank you for your response.
>
> Your point seems clear to me; let me go and put it in action and get
> back to you with the results.
>
> Best regards,
> -A
>
> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
> wrote:
>
> > Define boolean instance variable to track if something has been modified
> > since the last form retrieval.
>
> > boolean ib_modified = FALSE
>
> > Then set this variable to TRUE on all editable DWs' EditChanged and
> > ItemChanged events. Also, turn it to TRUE in the scripts where
> > InsertRow,
> > SetItem or DeleteRow is issued upon some of these DWs.
>
> > Set the variable to FALSE after successful Save (meaning Update() for
> > all
> > DWs + Commit) or Retrieve().
>
> > So the rest is to check this variable on CloseQuery.
>
> > HTH,
> > Ivaylo
>
> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>
> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>
> > > Hi all,
>
> > > I have a small question regarding DW.
>
> > > I have a window open in an MDI and the window contains a couple of DWs
> > > both of which are updatable.
> > > Now, when the user tries to close the window, I would like to
> > > determine if the Window (i.e., DWs are dirty or have been modified)
> > > and prompt the user to "save the changes or close anyway?".
>
> > > I have implemented this by doing the "modifiedcount() + deletedcount()
> > >> 0" stuff. This does NOT work because prior to this, I've got to do
> > > accepttext(). The problem with accepttext() is that it triggers error
> > > messages in ItemError event of the DW. I don't want to perform
> > > validation. I just want to determine if the DW has been modified or
> > > not.
>
> > > Can any one pls let me know whether what am trying to achieve is
> > > doable or not?
>
> > > The biggest part has been done but this piece is missing and without
> > > it, the whole application looks incomplete.
>
> > > Thanking you in advance for your time.
>
> > > Best,
> > > -A

Better (perhaps);

instance vars;
boolean ib_suppress_errors=false

closequery;
ib_suppress_errors=true
ll_valid = dw_1.accepttext()
ib_suppress_errors=false

if ll_valid <>1 then
if messagebox('...','... validation errors ... Do you want to close
anyway?',question!,yesno!) = 1 then return 0
return 1
end if

if modifiedcount() +
...


event itemerror();
if ib_supress_errors then return 1

...


Ivaylo Ivanov Posted on 2009-11-03 14:08:38.0Z
From: "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com> <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com> <4af0391e$1@forums-1-dub>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 109
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af03966$1@forums-1-dub>
Date: 3 Nov 2009 06:08:38 -0800
X-Trace: forums-1-dub 1257257318 10.22.241.152 (3 Nov 2009 06:08:38 -0800)
X-Original-Trace: 3 Nov 2009 06:08:38 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90208
Article PK: 409812

Please, excuse me, <JEREMY>
... it's coffee time....

"Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
news:4af0391e$1@forums-1-dub...
> Hi, Jerry
>
> I don't think any AcceptText() and validation logic must be issued on a
> window close at all, unless you have some Save logic there which is a
> different (means "strange" <g>) interface decision, IMHO.
>
> "Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
> news:9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com...
> On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
>> Hi Ivaylo,
>>
>> Thank you for your response.
>>
>> Your point seems clear to me; let me go and put it in action and get
>> back to you with the results.
>>
>> Best regards,
>> -A
>>
>> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
>> wrote:
>>
>> > Define boolean instance variable to track if something has been
>> > modified
>> > since the last form retrieval.
>>
>> > boolean ib_modified = FALSE
>>
>> > Then set this variable to TRUE on all editable DWs' EditChanged and
>> > ItemChanged events. Also, turn it to TRUE in the scripts where
>> > InsertRow,
>> > SetItem or DeleteRow is issued upon some of these DWs.
>>
>> > Set the variable to FALSE after successful Save (meaning Update() for
>> > all
>> > DWs + Commit) or Retrieve().
>>
>> > So the rest is to check this variable on CloseQuery.
>>
>> > HTH,
>> > Ivaylo
>>
>> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>>
>> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>>
>> > > Hi all,
>>
>> > > I have a small question regarding DW.
>>
>> > > I have a window open in an MDI and the window contains a couple of
>> > > DWs
>> > > both of which are updatable.
>> > > Now, when the user tries to close the window, I would like to
>> > > determine if the Window (i.e., DWs are dirty or have been modified)
>> > > and prompt the user to "save the changes or close anyway?".
>>
>> > > I have implemented this by doing the "modifiedcount() +
>> > > deletedcount()
>> > >> 0" stuff. This does NOT work because prior to this, I've got to do
>> > > accepttext(). The problem with accepttext() is that it triggers error
>> > > messages in ItemError event of the DW. I don't want to perform
>> > > validation. I just want to determine if the DW has been modified or
>> > > not.
>>
>> > > Can any one pls let me know whether what am trying to achieve is
>> > > doable or not?
>>
>> > > The biggest part has been done but this piece is missing and without
>> > > it, the whole application looks incomplete.
>>
>> > > Thanking you in advance for your time.
>>
>> > > Best,
>> > > -A
>
> Better (perhaps);
>
> instance vars;
> boolean ib_suppress_errors=false
>
> closequery;
> ib_suppress_errors=true
> ll_valid = dw_1.accepttext()
> ib_suppress_errors=false
>
> if ll_valid <>1 then
> if messagebox('...','... validation errors ... Do you want to close
> anyway?',question!,yesno!) = 1 then return 0
> return 1
> end if
>
> if modifiedcount() +
> ...
>
>
> event itemerror();
> if ib_supress_errors then return 1
>
> ...
>
>


Roland Smith [TeamSybase] Posted on 2009-11-03 20:11:33.0Z
From: "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com> <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com> <4af0391e$1@forums-1-dub> <4af03966$1@forums-1-dub>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 119
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af08e75@forums-1-dub>
Date: 3 Nov 2009 12:11:33 -0800
X-Trace: forums-1-dub 1257279093 10.22.241.152 (3 Nov 2009 12:11:33 -0800)
X-Original-Trace: 3 Nov 2009 12:11:33 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90211
Article PK: 409816

Without calling AcceptText, the ModifiedCount and DeletedCount will be
accurate except for the status of the current column. You can check the
current column by comparing GetText to a GetItemString that pulled the
Original value.

"Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
news:4af03966$1@forums-1-dub...
> Please, excuse me, <JEREMY>
> ... it's coffee time....
>
> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
> news:4af0391e$1@forums-1-dub...
>> Hi, Jerry
>>
>> I don't think any AcceptText() and validation logic must be issued on a
>> window close at all, unless you have some Save logic there which is a
>> different (means "strange" <g>) interface decision, IMHO.
>>
>> "Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
>> news:9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com...
>> On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
>>> Hi Ivaylo,
>>>
>>> Thank you for your response.
>>>
>>> Your point seems clear to me; let me go and put it in action and get
>>> back to you with the results.
>>>
>>> Best regards,
>>> -A
>>>
>>> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
>>> wrote:
>>>
>>> > Define boolean instance variable to track if something has been
>>> > modified
>>> > since the last form retrieval.
>>>
>>> > boolean ib_modified = FALSE
>>>
>>> > Then set this variable to TRUE on all editable DWs' EditChanged and
>>> > ItemChanged events. Also, turn it to TRUE in the scripts where
>>> > InsertRow,
>>> > SetItem or DeleteRow is issued upon some of these DWs.
>>>
>>> > Set the variable to FALSE after successful Save (meaning Update() for
>>> > all
>>> > DWs + Commit) or Retrieve().
>>>
>>> > So the rest is to check this variable on CloseQuery.
>>>
>>> > HTH,
>>> > Ivaylo
>>>
>>> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>>>
>>> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>>>
>>> > > Hi all,
>>>
>>> > > I have a small question regarding DW.
>>>
>>> > > I have a window open in an MDI and the window contains a couple of
>>> > > DWs
>>> > > both of which are updatable.
>>> > > Now, when the user tries to close the window, I would like to
>>> > > determine if the Window (i.e., DWs are dirty or have been modified)
>>> > > and prompt the user to "save the changes or close anyway?".
>>>
>>> > > I have implemented this by doing the "modifiedcount() +
>>> > > deletedcount()
>>> > >> 0" stuff. This does NOT work because prior to this, I've got to do
>>> > > accepttext(). The problem with accepttext() is that it triggers
>>> > > error
>>> > > messages in ItemError event of the DW. I don't want to perform
>>> > > validation. I just want to determine if the DW has been modified or
>>> > > not.
>>>
>>> > > Can any one pls let me know whether what am trying to achieve is
>>> > > doable or not?
>>>
>>> > > The biggest part has been done but this piece is missing and without
>>> > > it, the whole application looks incomplete.
>>>
>>> > > Thanking you in advance for your time.
>>>
>>> > > Best,
>>> > > -A
>>
>> Better (perhaps);
>>
>> instance vars;
>> boolean ib_suppress_errors=false
>>
>> closequery;
>> ib_suppress_errors=true
>> ll_valid = dw_1.accepttext()
>> ib_suppress_errors=false
>>
>> if ll_valid <>1 then
>> if messagebox('...','... validation errors ... Do you want to close
>> anyway?',question!,yesno!) = 1 then return 0
>> return 1
>> end if
>>
>> if modifiedcount() +
>> ...
>>
>>
>> event itemerror();
>> if ib_supress_errors then return 1
>>
>> ...
>>
>>
>
>


Ivaylo Ivanov Posted on 2009-11-04 08:29:33.0Z
From: "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com> <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com> <4af0391e$1@forums-1-dub> <4af03966$1@forums-1-dub> <4af08e75@forums-1-dub>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 127
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af13b6d$1@forums-1-dub>
Date: 4 Nov 2009 00:29:33 -0800
X-Trace: forums-1-dub 1257323373 10.22.241.152 (4 Nov 2009 00:29:33 -0800)
X-Original-Trace: 4 Nov 2009 00:29:33 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90212
Article PK: 409817

That's where EditChanged comes to help - you'll know the form is dirty
taking into account the current column as well (read my post).

"Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message
news:4af08e75@forums-1-dub...
> Without calling AcceptText, the ModifiedCount and DeletedCount will be
> accurate except for the status of the current column. You can check the
> current column by comparing GetText to a GetItemString that pulled the
> Original value.
>
> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
> news:4af03966$1@forums-1-dub...
>> Please, excuse me, <JEREMY>
>> ... it's coffee time....
>>
>> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
>> news:4af0391e$1@forums-1-dub...
>>> Hi, Jerry
>>>
>>> I don't think any AcceptText() and validation logic must be issued on a
>>> window close at all, unless you have some Save logic there which is a
>>> different (means "strange" <g>) interface decision, IMHO.
>>>
>>> "Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
>>> news:9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com...
>>> On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
>>>> Hi Ivaylo,
>>>>
>>>> Thank you for your response.
>>>>
>>>> Your point seems clear to me; let me go and put it in action and get
>>>> back to you with the results.
>>>>
>>>> Best regards,
>>>> -A
>>>>
>>>> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
>>>> wrote:
>>>>
>>>> > Define boolean instance variable to track if something has been
>>>> > modified
>>>> > since the last form retrieval.
>>>>
>>>> > boolean ib_modified = FALSE
>>>>
>>>> > Then set this variable to TRUE on all editable DWs' EditChanged and
>>>> > ItemChanged events. Also, turn it to TRUE in the scripts where
>>>> > InsertRow,
>>>> > SetItem or DeleteRow is issued upon some of these DWs.
>>>>
>>>> > Set the variable to FALSE after successful Save (meaning Update() for
>>>> > all
>>>> > DWs + Commit) or Retrieve().
>>>>
>>>> > So the rest is to check this variable on CloseQuery.
>>>>
>>>> > HTH,
>>>> > Ivaylo
>>>>
>>>> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>>>>
>>>> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>>>>
>>>> > > Hi all,
>>>>
>>>> > > I have a small question regarding DW.
>>>>
>>>> > > I have a window open in an MDI and the window contains a couple of
>>>> > > DWs
>>>> > > both of which are updatable.
>>>> > > Now, when the user tries to close the window, I would like to
>>>> > > determine if the Window (i.e., DWs are dirty or have been modified)
>>>> > > and prompt the user to "save the changes or close anyway?".
>>>>
>>>> > > I have implemented this by doing the "modifiedcount() +
>>>> > > deletedcount()
>>>> > >> 0" stuff. This does NOT work because prior to this, I've got to do
>>>> > > accepttext(). The problem with accepttext() is that it triggers
>>>> > > error
>>>> > > messages in ItemError event of the DW. I don't want to perform
>>>> > > validation. I just want to determine if the DW has been modified or
>>>> > > not.
>>>>
>>>> > > Can any one pls let me know whether what am trying to achieve is
>>>> > > doable or not?
>>>>
>>>> > > The biggest part has been done but this piece is missing and
>>>> > > without
>>>> > > it, the whole application looks incomplete.
>>>>
>>>> > > Thanking you in advance for your time.
>>>>
>>>> > > Best,
>>>> > > -A
>>>
>>> Better (perhaps);
>>>
>>> instance vars;
>>> boolean ib_suppress_errors=false
>>>
>>> closequery;
>>> ib_suppress_errors=true
>>> ll_valid = dw_1.accepttext()
>>> ib_suppress_errors=false
>>>
>>> if ll_valid <>1 then
>>> if messagebox('...','... validation errors ... Do you want to close
>>> anyway?',question!,yesno!) = 1 then return 0
>>> return 1
>>> end if
>>>
>>> if modifiedcount() +
>>> ...
>>>
>>>
>>> event itemerror();
>>> if ib_supress_errors then return 1
>>>
>>> ...
>>>
>>>
>>
>>
>
>


<jeff> Posted on 2009-11-05 16:19:49.0Z
Reply-To: <jeff>
From: <jeff>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com> <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com> <4af0391e$1@forums-1-dub> <4af03966$1@forums-1-dub> <4af08e75@forums-1-dub> <4af13b6d$1@forums-1-dub>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 153
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af2fb25$1@forums-1-dub>
Date: 5 Nov 2009 08:19:49 -0800
X-Trace: forums-1-dub 1257437989 10.22.241.152 (5 Nov 2009 08:19:49 -0800)
X-Original-Trace: 5 Nov 2009 08:19:49 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90225
Article PK: 409831

Editchanged fails ... and is not reliable:

- user starts to type, replace an entry.
- user decides to abondon change, and press esc.
- result, field is not changed - not changes to datewindow, modify count is
ZERO.
However, this flag at the editchange event level would be true ... unless
you are trapping escapes, cancels, undo's that could be programmed in to the
application.

- what if column values are changed with code ... the editchanged would not
fire, thus no setting the modified flag.

Your best bet is to rely on the buffers and focus on the other events to
help 'override' code that you do not want to execute.

Jeff.

"Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
news:4af13b6d$1@forums-1-dub...
> That's where EditChanged comes to help - you'll know the form is dirty
> taking into account the current column as well (read my post).
>
> "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message
> news:4af08e75@forums-1-dub...
>> Without calling AcceptText, the ModifiedCount and DeletedCount will be
>> accurate except for the status of the current column. You can check the
>> current column by comparing GetText to a GetItemString that pulled the
>> Original value.
>>
>> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
>> news:4af03966$1@forums-1-dub...
>>> Please, excuse me, <JEREMY>
>>> ... it's coffee time....
>>>
>>> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
>>> news:4af0391e$1@forums-1-dub...
>>>> Hi, Jerry
>>>>
>>>> I don't think any AcceptText() and validation logic must be issued on a
>>>> window close at all, unless you have some Save logic there which is a
>>>> different (means "strange" <g>) interface decision, IMHO.
>>>>
>>>> "Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
>>>> news:9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com...
>>>> On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
>>>>> Hi Ivaylo,
>>>>>
>>>>> Thank you for your response.
>>>>>
>>>>> Your point seems clear to me; let me go and put it in action and get
>>>>> back to you with the results.
>>>>>
>>>>> Best regards,
>>>>> -A
>>>>>
>>>>> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
>>>>> wrote:
>>>>>
>>>>> > Define boolean instance variable to track if something has been
>>>>> > modified
>>>>> > since the last form retrieval.
>>>>>
>>>>> > boolean ib_modified = FALSE
>>>>>
>>>>> > Then set this variable to TRUE on all editable DWs' EditChanged and
>>>>> > ItemChanged events. Also, turn it to TRUE in the scripts where
>>>>> > InsertRow,
>>>>> > SetItem or DeleteRow is issued upon some of these DWs.
>>>>>
>>>>> > Set the variable to FALSE after successful Save (meaning Update()
>>>>> > for all
>>>>> > DWs + Commit) or Retrieve().
>>>>>
>>>>> > So the rest is to check this variable on CloseQuery.
>>>>>
>>>>> > HTH,
>>>>> > Ivaylo
>>>>>
>>>>> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>>>>>
>>>>> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>>>>>
>>>>> > > Hi all,
>>>>>
>>>>> > > I have a small question regarding DW.
>>>>>
>>>>> > > I have a window open in an MDI and the window contains a couple of
>>>>> > > DWs
>>>>> > > both of which are updatable.
>>>>> > > Now, when the user tries to close the window, I would like to
>>>>> > > determine if the Window (i.e., DWs are dirty or have been
>>>>> > > modified)
>>>>> > > and prompt the user to "save the changes or close anyway?".
>>>>>
>>>>> > > I have implemented this by doing the "modifiedcount() +
>>>>> > > deletedcount()
>>>>> > >> 0" stuff. This does NOT work because prior to this, I've got to
>>>>> > >> do
>>>>> > > accepttext(). The problem with accepttext() is that it triggers
>>>>> > > error
>>>>> > > messages in ItemError event of the DW. I don't want to perform
>>>>> > > validation. I just want to determine if the DW has been modified
>>>>> > > or
>>>>> > > not.
>>>>>
>>>>> > > Can any one pls let me know whether what am trying to achieve is
>>>>> > > doable or not?
>>>>>
>>>>> > > The biggest part has been done but this piece is missing and
>>>>> > > without
>>>>> > > it, the whole application looks incomplete.
>>>>>
>>>>> > > Thanking you in advance for your time.
>>>>>
>>>>> > > Best,
>>>>> > > -A
>>>>
>>>> Better (perhaps);
>>>>
>>>> instance vars;
>>>> boolean ib_suppress_errors=false
>>>>
>>>> closequery;
>>>> ib_suppress_errors=true
>>>> ll_valid = dw_1.accepttext()
>>>> ib_suppress_errors=false
>>>>
>>>> if ll_valid <>1 then
>>>> if messagebox('...','... validation errors ... Do you want to close
>>>> anyway?',question!,yesno!) = 1 then return 0
>>>> return 1
>>>> end if
>>>>
>>>> if modifiedcount() +
>>>> ...
>>>>
>>>>
>>>> event itemerror();
>>>> if ib_supress_errors then return 1
>>>>
>>>> ...
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Ivaylo Ivanov Posted on 2009-11-05 17:24:54.0Z
From: "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com>
Newsgroups: sybase.public.powerbuilder.datawindow
References: <012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com> <4af00f8d@forums-1-dub> <a4a1a1fb-ff34-48f8-9300-0ea146dc35f0@b15g2000yqd.googlegroups.com> <9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com> <4af0391e$1@forums-1-dub> <4af03966$1@forums-1-dub> <4af08e75@forums-1-dub> <4af13b6d$1@forums-1-dub> <4af2fb25$1@forums-1-dub>
Subject: Re: How to determine if a DataWindow is dirty (has been modified)?
Lines: 182
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4af30a66@forums-1-dub>
Date: 5 Nov 2009 09:24:54 -0800
X-Trace: forums-1-dub 1257441894 10.22.241.152 (5 Nov 2009 09:24:54 -0800)
X-Original-Trace: 5 Nov 2009 09:24:54 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:90227
Article PK: 409830

Hi, Jeff
read my comments along your post:

> Editchanged fails ... and is not reliable:

??

>
> - user starts to type, replace an entry.
> - user decides to abondon change, and press esc.
> - result, field is not changed - not changes to datewindow, modify count
> is ZERO.

It depends on how you formulate the task. If we assume that every keystroke
within a field makes it "dirty", I don't care about future escapes. If you
want more precise logic, then a more complex solution might be needed.

> However, this flag at the editchange event level would be true ... unless
> you are trapping escapes, cancels, undo's that could be programmed in to
> the application.

If you didn't notice in my post, I suggest trapping cancels (meaning
Retrieve()).

>
> - what if column values are changed with code ... the editchanged would
> not fire, thus no setting the modified flag.

Again refer to my post - turn on the flag in the scripts performing
SetItem()

>
> Your best bet is to rely on the buffers and focus on the other events to
> help 'override' code that you do not want to execute.

Still not sure that this is the best bet, imho. Sometimes the flag is just
enough, sometimes the buffers are just enough, sometimes custom
buffers+flags or special hidden columns would help. Once again, nobody can
be sure which one is best for all situatons.

Kind regards,
Ivaylo

>
> Jeff.
>
> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
> news:4af13b6d$1@forums-1-dub...
>> That's where EditChanged comes to help - you'll know the form is dirty
>> taking into account the current column as well (read my post).
>>
>> "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com> wrote in message
>> news:4af08e75@forums-1-dub...
>>> Without calling AcceptText, the ModifiedCount and DeletedCount will be
>>> accurate except for the status of the current column. You can check the
>>> current column by comparing GetText to a GetItemString that pulled the
>>> Original value.
>>>
>>> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
>>> news:4af03966$1@forums-1-dub...
>>>> Please, excuse me, <JEREMY>
>>>> ... it's coffee time....
>>>>
>>>> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message
>>>> news:4af0391e$1@forums-1-dub...
>>>>> Hi, Jerry
>>>>>
>>>>> I don't think any AcceptText() and validation logic must be issued on
>>>>> a window close at all, unless you have some Save logic there which is
>>>>> a different (means "strange" <g>) interface decision, IMHO.
>>>>>
>>>>> "Jeremy Lakeman" <jeremy.lakeman@gmail.com> wrote in message
>>>>> news:9495acd2-2713-4cc5-8e5f-50c619f8b64c@o9g2000prg.googlegroups.com...
>>>>> On Nov 3, 9:50 pm, "@maram" <atmaram.mull...@gmail.com> wrote:
>>>>>> Hi Ivaylo,
>>>>>>
>>>>>> Thank you for your response.
>>>>>>
>>>>>> Your point seems clear to me; let me go and put it in action and get
>>>>>> back to you with the results.
>>>>>>
>>>>>> Best regards,
>>>>>> -A
>>>>>>
>>>>>> On Nov 3, 11:10 am, "Ivaylo Ivanov" <n0_S_p_a_m_i.iva...@isy-dc.com>
>>>>>> wrote:
>>>>>>
>>>>>> > Define boolean instance variable to track if something has been
>>>>>> > modified
>>>>>> > since the last form retrieval.
>>>>>>
>>>>>> > boolean ib_modified = FALSE
>>>>>>
>>>>>> > Then set this variable to TRUE on all editable DWs' EditChanged and
>>>>>> > ItemChanged events. Also, turn it to TRUE in the scripts where
>>>>>> > InsertRow,
>>>>>> > SetItem or DeleteRow is issued upon some of these DWs.
>>>>>>
>>>>>> > Set the variable to FALSE after successful Save (meaning Update()
>>>>>> > for all
>>>>>> > DWs + Commit) or Retrieve().
>>>>>>
>>>>>> > So the rest is to check this variable on CloseQuery.
>>>>>>
>>>>>> > HTH,
>>>>>> > Ivaylo
>>>>>>
>>>>>> > "@maram" <atmaram.mull...@gmail.com> wrote in message
>>>>>>
>>>>>> >news:012da178-a8da-43df-8baa-0d969565a7a6@f16g2000yqm.googlegroups.com...
>>>>>>
>>>>>> > > Hi all,
>>>>>>
>>>>>> > > I have a small question regarding DW.
>>>>>>
>>>>>> > > I have a window open in an MDI and the window contains a couple
>>>>>> > > of DWs
>>>>>> > > both of which are updatable.
>>>>>> > > Now, when the user tries to close the window, I would like to
>>>>>> > > determine if the Window (i.e., DWs are dirty or have been
>>>>>> > > modified)
>>>>>> > > and prompt the user to "save the changes or close anyway?".
>>>>>>
>>>>>> > > I have implemented this by doing the "modifiedcount() +
>>>>>> > > deletedcount()
>>>>>> > >> 0" stuff. This does NOT work because prior to this, I've got to
>>>>>> > >> do
>>>>>> > > accepttext(). The problem with accepttext() is that it triggers
>>>>>> > > error
>>>>>> > > messages in ItemError event of the DW. I don't want to perform
>>>>>> > > validation. I just want to determine if the DW has been modified
>>>>>> > > or
>>>>>> > > not.
>>>>>>
>>>>>> > > Can any one pls let me know whether what am trying to achieve is
>>>>>> > > doable or not?
>>>>>>
>>>>>> > > The biggest part has been done but this piece is missing and
>>>>>> > > without
>>>>>> > > it, the whole application looks incomplete.
>>>>>>
>>>>>> > > Thanking you in advance for your time.
>>>>>>
>>>>>> > > Best,
>>>>>> > > -A
>>>>>
>>>>> Better (perhaps);
>>>>>
>>>>> instance vars;
>>>>> boolean ib_suppress_errors=false
>>>>>
>>>>> closequery;
>>>>> ib_suppress_errors=true
>>>>> ll_valid = dw_1.accepttext()
>>>>> ib_suppress_errors=false
>>>>>
>>>>> if ll_valid <>1 then
>>>>> if messagebox('...','... validation errors ... Do you want to close
>>>>> anyway?',question!,yesno!) = 1 then return 0
>>>>> return 1
>>>>> end if
>>>>>
>>>>> if modifiedcount() +
>>>>> ...
>>>>>
>>>>>
>>>>> event itemerror();
>>>>> if ib_supress_errors then return 1
>>>>>
>>>>> ...
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>