?
Solved

control button within Datawindow displays error when clicked

Posted on 2005-03-04
7
Medium Priority
?
1,305 Views
Last Modified: 2013-12-26
I have the following error when I hit a button within a detail datawindow:
It happens in the clicked event of uo_dw.  It cannot access dwo.id

Error Number 39.
Error text = Error accessing external object property id at line 22 in clicked event of object uo_dw..
Window/Menu/Object = uo_dw.
Error Object/Control = uo_dw.
Script = clicked.
Line in Script = 22.

I'm using Powerbuilder 9
0
Comment
Question by:wydrom
[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 18

Expert Comment

by:diasroshan
ID: 13464618
hi,

can u paste the code in ur clicked event so i can point the error...

its basically an error in code
ur referencing an object which does not exist...
so check line 22 and check the dwo.id... see if it exists... also check if ur using any dot object notation and is it right....

also try using dwo.name instead...

Do let me know for more assistance.... paste the code so that i can help to pin point the error in code...

Cheers,
Rosh
0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 13466192
hi,

also better to write down your code in 'buttonclicked' event of datawindow control (i.e. uo_dw)

your sample code will be like this...
say datawindow control is uo_dw and button name in datawindow object is cb_add

Object : uo_dw
event : buttonclicked

If dwo.name = 'cb_add' Then
  This.InsertRow(0)
End If

Good Luck,
Sandeep
0
 
LVL 8

Expert Comment

by:gajender_99
ID: 13474898
hi

in your script where you are getting the dwo.id just befor that
long vl_id
if dwo.getrow()>0 then
  vl_id=dwo.getitmenumber(dwo.getrow(),"id")
End if

see if this solves the problem

thanks


0
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!

 

Author Comment

by:wydrom
ID: 13485867
The clicked event occurs when I click on a button on a detail datawindow.  The clicked() event script is in the highest ancestor object "uo_dw".  This clicked event works for everything else that is clicked except when this button is clicked.  The button's name is t_stock.  

I don't understand why I didn't have this problem before I migrated from PB5 to PB9.  I don't understand why now the id of t_stock is not passing into this clicked() event.

Here is the code for the "clicked( integer xpos, integer ypos, long row, dwobject dwo)" event script of the ancestor uo_dw:

/*
**      Used to make sure that the row gets set even if they click on a column
**      with a tab order of 0
*/
string      tab,ls_clickedcolumnID

SetPointer(HourGlass!)

/*
**      Set row focus even if tab order = 0.
**      Return if click was not on a valid dwobject, depending on what was
**      clicked, dwo will be null or dwo.name will be "datawindow"
*/

If IsNull(dwo) OR dwo.name = "datawindow" Then Return

//If IsNull(dwo) Then Return
//If dwo.name = "datawindow" Then Return

//Find which column was clicked on and return if it is not valid

If ClassName(dwo.id) <> 'string' Then Return   // FAILS HERE
ls_clickedcolumnID       = dwo.id
If ls_clickedcolumnID = '' Then Return

If row <> this.GetRow() then
      tab = Describe('#'+ls_clickedcolumnID +'.TabSequence')
      If tab = '0' Then this.SetRow(row)
End If
/*
**      Bring this datawindow control into focus on top of all others.
*/
this.BringToTop=True
0
 
LVL 18

Accepted Solution

by:
diasroshan earned 2000 total points
ID: 13495335
hi,
dwo.id can be used only for columns and not for buttons.

Cheers,
Rosh
0
 

Author Comment

by:wydrom
ID: 13495552
YES!!  That's why.  That allowed me to fix the problem.  I did a messagebox on dow.type and found it not to be a button, but raised text.    It looked like a button, but it was raised text.  When you said "dwo.id can be used only for columns and not buttons", it made me realize I need to check the dwo.type, not dwo.id.  It kept blowing up when I did "If isNull(dwo.id)".  It could find the reference of something that it couldn't even check to see if it was null.  

Your answer, Rosh, is what triggered my brain to realize what I needed to do.  I've got many years of C programming, but still learning the OO world.
THANKS!!!
0
 
LVL 18

Expert Comment

by:diasroshan
ID: 13495738
thanx for the grade and points...

Glad tio give that extra push buddy ;)

Cheers,
Rosh
0

Featured Post

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.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

771 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