How to "pause" visibility of DlgProgress?  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: Tracker Support, TrackerSupp-Daniel, Sean - Tracker, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1418
Joined: Thu Sep 05, 2019 12:35 pm

How to "pause" visibility of DlgProgress?

Post by zarkogajic »

Hi Support,

Is there a way to pause the visibility (hide) the progress dialog or stop it from showing (due to first display time delay) until "cancel visibility pause"?

I'm doing some IOperations, using ProgressMon, and at some moment I need to ask the user something ... so need to somehow hide the progress window until user reaction...



-žarko
zarkogajic
User
Posts: 1418
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "pause" visibility of DlgProgress?

Post by zarkogajic »

Hi Support,

I have this kind of solved.

I'm, atm, using ShowWindow(DlGProgress.WndHandle, SW_HIDE) to hide the dialog.

Then after my message dialog (modal) was displayed and user reacted, I'm re-showing it using ShowWindow(DlGProgress.WndHandle, SW_SHOWNOACTIVATE);

This works if the DlgProgress was already visible before the call to "Hide" (why in p.s.2).

Does not work if I call my Hide before the progress dialog gets display (even if I have WndHandle of it) - the display is delayed due to how you do it (and from different thread). So if that happens after my Hide - it will still get displayed ...

So, if you could maybe add a style like "ProgressStyle_Hidden" - which I could set (and remove) which would deny the dialog from being displayed if that style is set.

p.s.
I know I might be asking too much :) But, you never know....

p.s.2
I'm grabbing the WndHandle when the dialog is first displayed via IUIX_EventMonitor and when pEvent.Code = e.Visible and pEvent.Param1 = 1. This means I can only get the handle once first displayed - so if delayed - my above Hide/Show idea would not work.

Q: Could I get the WndHandle even before? (It would be better but would not still solve the problem of delayed display)

That's why ProgressStyle_Hidden would do the trick for me (I think).


-žarko
zarkogajic
User
Posts: 1418
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "pause" visibility of DlgProgress?

Post by zarkogajic »

Hi Support,

The first event that gets fired in EventMonitor for Target.ID = "DlgProgress" has a value of "799" for Event.Code.

I cannot figure out what UIX Event Code is that (or Windows message or anything like that).

When 799 fires, WndTarget is set - so I guess this is the moment when you create that dialog.

Since I do not want to work with fixed numbers ... what message or code would that be ?

-žarko
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2414
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to "pause" visibility of DlgProgress?

Post by Vasyl-Tracker Dev Team »

Our custom UI-event codes start from this value:

UIX_EventCodes.e_First = (0x400 + 5432)

- all codes less than this value are codes of standard windows messages. So, when your 799 is a decimal number, not in the hex form - it corresponds to WM_DWMNCRENDERINGCHANGED=0x031F, according to the WinUser.h.
Does not work if I call my Hide before the progress dialog gets display (even if I have WndHandle of it) - the display is delayed due to how you do it (and from different thread). So if that happens after my Hide - it will still get displayed ...
For this case, I think it is better to try to handle the WM_SHOWWINDOW (0x0018) message...
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1418
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "pause" visibility of DlgProgress?

Post by zarkogajic »

Hi Vasyl,

Thanks, yes, I've figured out this is WM_DWMNCRENDERINGCHANGED - but that's not usable for me as "the moment of creation".

The WM_SHOWWINDOW I can already catch via IUIX_Event.Code = e.Visible (and Param1 = 1 for "show"). (The WM_SHOWWINDOW happens after e.Visible).

When e_Visible happens - I would like to "cancel the event" - I've tried setting pEvent.Result - but no changes - the dialog get displayed. Q: Can this be done?

All the above would not be needed if : any chance you could add a style like "ProgressStyle_Hidden" ?

Also, I know you create that dialog during Inst.Init. I cannot RegisterEventMonitor before that so to catch e.First (to grab the WndHandle).

p.s.
Just to be sure: WndHandle - once DlgProgress is created and it gets WndHandle - could/would it be recreated at any time during the lifecycle of Instance?

-žarko
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2414
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to "pause" visibility of DlgProgress?

Post by Vasyl-Tracker Dev Team »

Hi Zarko.

Theoretically, the possible way is:

Code: Select all

int id_DlgProgress = Inst.Str2ID("DlgProgress");
bool bNeedHideProgressDlg = false;

....

OnEventMonitor(IUIX_Obj target, IUIX_Event* event)
{
	if (bNeedHideProgressDlg)
	{
		if (event.Code == e_Visible)
		{
			if ((target.ID == id_DlgProgress) && (target.Param1 != 0)) // before appearing progress dlg
			{
				target.Show(SW_HIDE, true);
			}
		}
	}
}
p.s.
Just to be sure: WndHandle - once DlgProgress is created and it gets WndHandle - could/would it be recreated at any time during the lifecycle of Instance?
It can be recreated if you use Inst.Init(), then Inst.Shutdown() and then Inst.Init() again, and so on. But between Init() and corresponding Shutdown() - it is always the same.

HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1418
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "pause" visibility of DlgProgress?  SOLVED

Post by zarkogajic »

Hi Vasyl,

OK, I can work with that, thanks.

-žarko
Post Reply