1. Arthur Foux
  2. PowerBuilder
  3. Friday, 11 October 2019

I am attempting to display a custom title for a window with tabs. I can get the info when the record is retrieved

 

//// Get the name of the Company and display it in the window title bar

//string theconame

lw_frame = w_thecompany

////theconame = dw_co1.getitemstring(1, "comp_name")

//lw_frame.Title = " Data Entry Screen for: "  + theconame

 

1.  //w_thecompany.tab_1.tabpage_1.dw_co1.Title = " Data Entry Screen for: " + theconame

 

2.  //w_ thecompany.tab_1.tabpage_1.dw_co1.Title = ("Data Entry Screen for:")  + string(theconame)

 

3.  //w_ thecompany.tab_1.tabpage_1.dw_co1.Triggerevent ("pfc_pagesetup")

None of the above worked

Number 3 was an attempt to execute on the window.  I kept getting this error.

MessageBox ("let see5",  string(theconame)) this message box showed the name of he company.

Thank You for your help.

 

Miguel Leeuwe Accepted Answer Pending Moderation
0
Votes
Undo

Looking at your code "...pfc_pagesetup()..." it seems you're working with pfc classes.

I'm assuming that you want "lw_frame" to be a reference to the mdi frame window of your application, if I'm wrong and it's not an mdi frame window but maybe a normal sheet window or response window, then the name is confusing and things will be different.

So assuming it's the mdi frame of your application:

To refer to the mdi frame window you'll have to do 

1) 

w_frame  lw_frame

lw_frame = gnv_app.of_getFrame()

lw_frame.Title = "I'm a Framed window with a changed title."

 

... or if your framewindow is named w_thecompany, then

 

w_thecompany  lw_frame

lw_frame = gnv_app.of_getFrame()

lw_frame.Title = "I'm a Framed window with a changed title."

(lots of times people will assign the result of gnv_app.of_getFrame() to a global variable of called gw_frame or similar, so they don't have to call the function all the time everywhere they want to refer to the frame window. I you have that variable and it's valid ( Isvalid(gw_frame) ), then you can use that one instead:

if not isvalid(gw_frame) then

gw_frame = gnv_app.of_getFrame()

end if

gw_frame.Title = "I'm a Framed window with a changed title."

)

or ...

 

2) You might even get away with simply directly referring to the w_thecompany window like this

w_thecompany.Title = "I'm a Framed window with a changed title."

(so without using a local lw_frame variable or assignment to it at all. This will work for windows of which only ONE can be open at the same time, so it "won't work" for sheets which can have multiple instances).

 

I'm not too sure though that your mdi frame window really would be named w_thecompany, but I could be wrong.

regards

Comment
There are no comments made yet.
  1. Saturday, 12 October 2019
  2. PowerBuilder
  3. # 1
Michael Kramer Accepted Answer Pending Moderation
0
Votes
Undo

What is the value of w_thecompany?

Every window class has a global variable of same name as the class.

I'm asking because you assign value from the global variable to local lw_frame.

That is only a valid reference if it was used EXPLICITLY in Open or OpenSheet (with or without parms).

Some of your open/active windows may be of type w_thecompany but that has no influence on the same named global variable.

HTH /Michael

 

Comment
There are no comments made yet.
  1. Saturday, 12 October 2019
  2. PowerBuilder
  3. # 2
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Arthur;

   Try "posting" the PFC event instead of triggering as the error seems DW related.

Remember also that the PBDebugger  is your friend to allow stepping through / into / over your code & introspect your codes surroundings.

Regards ... Chris

Comment
Thanks Chris.
  1. Arthur Foux
  2. Saturday, 12 October 2019
PS: check the Tab Control to see if the "Create On Demand" property is ON. If so, you'll have to rethink your approach to using direct object addressing from outside the TC.
  1. Chris Pollach
  2. Saturday, 12 October 2019
There are no comments made yet.
  1. Saturday, 12 October 2019
  2. PowerBuilder
  3. # 3
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.