PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: steezware on August 09, 2023, 06:19:35 PM

Title: Accessing a Control on Another Dialog
Post by: steezware on August 09, 2023, 06:19:35 PM
So, I'm in a dialog and I want to access/update a control, say a listbox, on the window that spawned the current dialog with focus.

Seems like I used to know how to do this, but maybe it can't even be done?

Thx!
Title: Re: Accessing a Control on Another Dialog
Post by: Ken Sproul on August 09, 2023, 06:36:14 PM
Are you doing a 'goto'(the_window_with_the_control), before trying to access the control?
Title: Re: Accessing a Control on Another Dialog
Post by: steezware on August 09, 2023, 07:14:02 PM
Figured it out:

PRINT 'SWAP'
LB'Visible = 0 (I passed the LB control value into the new 'process)
PRINT 'SWAP'

Thx for the 'goto' idea but tried 'swap' first and it worked.
Title: Re: Accessing a Control on Another Dialog
Post by: Mike King on August 09, 2023, 09:03:36 PM
It likely would be easier to just use Pseudo control handles.  You can use the *system object to get the handle for any control in the system and then use it anywhere to access the control. 

https://manual.pvxplus.com/page/objctl2/overview.htm

->button 10,@(10,10,10,10)="hello
->osys=new("*system")
->%Btn_handle=osys'Control(10)
->?Btn_handle
 1000100010
Title: Re: Accessing a Control on Another Dialog
Post by: James Crowther on August 10, 2023, 01:13:49 PM
(https://media1.giphy.com/media/OK27wINdQS5YQ/200w.gif?cid=790b7611szc9bnghu4s8z1ymblw9keftd2jmmozjv589k7uw&ep=v1_gifs_search&rid=200w.gif&ct=g)