Solved

Powerbuilder DataWindow - Preventing New Row when Tabbing Off Last Column

Posted on 2010-11-09
7
1,929 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:cintra
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

772 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

10 Experts available now in Live!

Get 1:1 Help Now