Solved

Powerbuilder DataWindow - Preventing New Row when Tabbing Off Last Column

Posted on 2010-11-09
7
1,956 Views
Last Modified: 2013-12-26
Hi All,

I would be grateful for suggestions on the following scenario.

We have a dynamically created datawindow, which is used as a data entry form.
We only ever want one row in this datawindow, but each time the user tabs off
the last last column on the datawindow a new row is created. Without having to
use the DeleteRow function, is there any way of preventing the new row being created
when the user tabs off the last column? I can trap the Tab key press using event id, pbm_dwnkey, but as far as I can see Powerbuilder has already generated the row by the time the script associated with pbm_dwnkey runs. I think I'm really looking for a way to prevent Powerbuilder creating a new row, when one exists already.

Thanks

DL


 
0
Comment
Question by:cintra
7 Comments
 
LVL 1

Assisted Solution

by:stanner
stanner earned 100 total points
ID: 34094480
Are you sure you don't have anything in your datawindow to "cause" it to jump to a new record? By default, PowerBuilder does not insert a new record when you tab off the last field. Focus either jumps to the next object on the window, or back to the first column on the same row in the datawindow. You actually have to "make" it insert a new row. I just tried it again now to confirm, in case I was losing my mind. If you already have multiple rows in the datawindow, THEN it will jump to the next record, but it won't actually create one by default (unless something has changed). Is there any chance you already generated more than one empty row, and it's just jumping to one of those?
0
 

Author Comment

by:cintra
ID: 34094768
Thanks for the response. I'm fairly certain there is only one InsertRow occurring, but I will double check.
 
0
 
LVL 14

Assisted Solution

by:sandeep_patel
sandeep_patel earned 100 total points
ID: 34137786
Are you using PFC? or check there is any code written in itemchanged or losefocus events. Such coding should have been done mostly in acenstor objects. Check object hierarchy and see if code is written in above events to insert a row.

Regards,
Sandeep
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:cintra
ID: 34147207
Hi Again,

Thanks for the comments above. I am not using PFC, but I notice that the behaviour of a dataobject created as freeform is different from a dataobject
created as tabular. When the freeform datawindow is placed on a window, tabbing off the last column does not create a new row, but if the tabular datawindow is used on the window, tabbing off does indeed generate a new row. I think my dynamically created datawindow may be getting created as a tabular datawindow, even though it's only ever supposed to hold one row. I will do further checking and revisit the question to assign points to all who responded.

Thanks




 
0
 
LVL 2

Accepted Solution

by:
Ariel Garcia earned 300 total points
ID: 37442833
I resolve this:
On Event "RowFocusChanging" write this...

If RowCount() = 1 Then
    Return 1
End if

RowFocusChanging:
Occurs when the current row is about to change in the DataWindow. (The current row of the DataWindow is not necessarily the same as the current row in the database.)

Return Value:
Set the return code to affect the outcome of the event:
0  Continue processing (setting the current row)
1  Prevent the current row from changing

0
 

Author Comment

by:cintra
ID: 37445525
Thanks for this leirags.

I think that could be the solution.
I will do some testing and report back.

Thanks

DL
0
 

Author Comment

by:cintra
ID: 37492820
Hi all,

I can't replicate the beheaviour I originally described with a "normal" datawindow, but only with one that is dynamically created at run time. In any case, I have discovered a work around, based on the suggestion from leirags.

I will distribute poinst to all who responded.

DK.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now