Solved

Powerbuilder DataWindow - Preventing New Row when Tabbing Off Last Column

Posted on 2010-11-09
7
2,112 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
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.
Suggested Courses

623 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