Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access a control that is on a tab object

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
I have a tab object that is placed on a window. I have various controls on each tabpage. How can I access a datawindow that is placed on a tabpage?

For example, I 've tried the following:

windowname.tab.tabpage.datawindow.

I've tried various combo's of the above syntax and I always get an error when trying to compiled the code. I want to access this control outside of the tab object. For instance, I would like to access it through a user event on the window.

What is the proper syntax for doing this?

Thanks,

Keith
 
Try tabcontrol.tabpage.userobjectname.datawindow.function (or event)
 
Thanks. However, there is one other thing I forgot to mention. How do I dynamically code for the name of the tabpage. For instance, each tab on the tabcontrol is used for the alphabet(a - z). If I want to reference the 2nd tabpage, which is 'B' for the text, How can I reference this in the code? In other words, if the user selects the 2nd tabpage. I've tried the following:

tabcontrol.tabpage[2].userobectname.control

Thanks.
 
You were very close. Control is the variable that you are looking for. So the 2nd tab page would be
tab_1.control[2].object.contorl
 
Thanks. I've tried this and I'm getting a compile error. The following is how I coded it in a user event of the window that has the tab control/user object:

tab_1.control[2].uo_name.tv_pat.finditem(RootTreeItem!,ll_handle)

This is the error I get when I try to compile the script:
Incompatible property uo_name for type userobject

This window has the tab control called tab_1. I've inserted the userobject, uo_name, into the tab control.

Why am I still getting a compile error?

Keith

 
Your problem is a little tricky. You are getting compile error because tab_1.control[2] (which is your second tabpage) does not have any member of class uo_name as intrinsic PB member/method. This member is available only at the run time thru the control array. So you will have to write some roundabout code to handle this:

tabpage tp_1
uo_name_class uo_name_temp
integer li_ctr

tp_1 = tab_1.control[2]
for li_ctr = 1 to upperbound(tp_1.control)
if tp_1.control[li_ctr].classname() = 'uo_name' then
uo_name_temp = uo_name
uo_name_temp.tv_pat.finditem(.........)
end if
next
 
I've tried your suggestion. However, when I try to compile I get the following error:

illegal data type: tabpage

I have a tab control on a window, which I've inserted a userobject into the tabpage.

Am I overlooking something? I've look into PB help but could not find if this is a valid datatype or not.

How can I correct this?

Thanks,

Keith
 
I am sorry for the wrong datatype.

Instead of

tabpage tp_1
.....
.....

write the code as

userobject tp_1
....
....


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top