Link to home
Start Free TrialLog in
Avatar of Mouah
Mouah

asked on

Changing dynamically WindowType ( transform a Main! windows to a Reponse! one )

Hello all,

I'd like to open an existing window, but as if it was a Response! type one.

In fact, I want a Powerbuilder program to open a window (not response most of time), and wait for the end of it's execution but without using timer stuff and/or Yield loop.

Thanks for your help

Pierre.
ASKER CERTIFIED SOLUTION
Avatar of namasi_navaretnam
namasi_navaretnam
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mouah
Mouah

ASKER

Namasi, thank you for your help

But where will I put script that change all this properties ?
I've tried these syntax, and Powerbuilder7 didn't accept any:

----------------------------------------------
SYNTAX 1
----------------------------------------------
MyWindow lw_test

Open( lw_test )

lw_test.MenuName = ""
... (some other properties)

lw_test.WindowType = Response!

--> <<Error: A ReadOnly property may only be modified  in an event  or function in its parent class>>

----------------------------------------------
SYNTAX 1
----------------------------------------------
In the MyWindow.Open or MyWindow.wf_function() or MyWindow.ue_Event()

this.WindowType = Response!

--> <<Error: A SystemWrite property may only be modified  in an event  or function in its parent class>>

What is 'event or function in its parent class' ?
Where will I code the WindowType property assignation ?

Thank you for your help

Pierre
Pierre,

This does not wok. I think it worked in an earlier version. (4 may be). I tried it with PB 9 and does work as you say.

You can use windows APIs to wait until a process complete.

See issue below:

https://www.experts-exchange.com/questions/20775852/how-to-know-closing-of-one-window-within-another.html

Namasi
Avatar of Mouah

ASKER

Namasi,

In fact, as I said, I didn't wait some 'Wait Loop' nether kernel DLL stuff.

But, I found by myself a sort of answer, but maybe you could help:

I created my "Main! Window", and exported the script.
In the 'on create' part, I added this code:
>>
on w_myWindow.create
this.st_test=create st_test
this.cb_someButton=create cb_someButton
this.Control[]={this.st_test,&
this.cb_someButton}
windowtype = f_windowtype( classname( this ))
end on
<<

With "f_windowtype()" a global function witch return a windowType enum variable.
By writing code in this function to choose at runtime my windowType, it's working fine. But I still have a problem: as this code is generated by PowerBuilder automaticly, each time I edit and save my object window, PowerBuilder rewrite the original code (without the call of my function).

I think in Powerbuilder9 it's possible to write your own code in 'system script', but I still using PowerBuilder 7. Is there a solution ? ( except re-export/import my script each time )

Thanks again.

Pierre
I would not even try it. It is not recommended to change exported file and they will be recreated when re-generating the objects. No. PB 9 does not allow it.

Try to use the win APIs. They work just fine.