Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1343
  • Last Modified:

control button within Datawindow displays error when clicked

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
wydrom
Asked:
wydrom
1 Solution
 
diasroshanCommented:
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
 
sandeep_patelCommented:
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
 
gajender_99Commented:
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
Industry Leaders: 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!

 
wydromAuthor Commented:
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
 
diasroshanCommented:
hi,
dwo.id can be used only for columns and not for buttons.

Cheers,
Rosh
0
 
wydromAuthor Commented:
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
 
diasroshanCommented:
thanx for the grade and points...

Glad tio give that extra push buddy ;)

Cheers,
Rosh
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now