CustomWindow message in Exclusive mode - Forum

Forum Navigation
You need to log in to create posts and topics.

CustomWindow message in Exclusive mode

For any reason @ebear (Eric Beerhorst) is having issues publising this post, so I'm posting it in his name.

Hello All,

I try to create an "loading - Processing" message with an CustomWindow. I need to use the "Exclusive" mode, so that the user can not click in the application during the process. I want to use the OnShow option to start the process when the CustomWindow is shown. This works perfect, but if I want to close the windows on the end of the process a failure message shows (see the attached image) and the CustomWindow does not close.

This is the simple code I use to test before I implement in the application, in the sample application I have an button which starts the Sub :Start

:Start
    CustomWindow "" "-1" "-1" "Container1" "DialogBox+Exclusive+NoCloseBtn"
Return

:Container1_OnOpen
   GoSub "Count"
   GoSub "CloseWindow"
Return

:Count
   CustomWindow "" "-1" "-1" "Container1" "DialogBox+Exclusive+NoCloseBtn"
   Loop "1" "1000" "[Count]"
      . Delay "2000"
   EndLoop Return

:CloseWindow
   CloseCustomWindow "Container1"
Return

:Container1_OnClose
Return

What I'm doing wrong??
Thanks a lot.

Best regards,

Eric Beerhorst

@ebear

1) Why do you have a CustomWindow command in the Count subroutine (which is called from the _onOpen subroutine) of the SAME window that is being opened in the Start subroutine ... worst case, this could send the whole process into an infinite loop ... if VisualNEOWin tried to open a second identical window (which in turn would trigger another _onOpen subroutine (which would open a third identical window and so on).

2) Also not a good idea to have a loop/endloop block with nothing in it ... can lock up the system for long periods of time ... better to perhaps have a command that displays the value of [Count] in one of the objects inside your Container1

@ebear

@luishp

Replying to original post because I get "Forbidden Content" error message ...

I try to create an "loading - Processing" message with an CustomWindow.

I am not sure what this means. Perhaps you can describe in detail what kind of logic you are trying to implement.

... more ...

I need to use the "Exclusive" mode, so that the user can not click in the application during the process.

ok

... even more ...

I want to use the On Show option to start the process when the Custom Window is shown. This works perfect, but if I want to close the windows on the end of the process a failure message shows (see the attached image) and the Custom Window does not close.

No attached image.

 

OK this worked after I put spaces between On and Show and between Custom and Window !!!

Last note from me ... this process may not even have worked (error message could have been generated from your attempting open the same Custom Window a second time).

 

 

Hello Gaev,

Trying to react (see if this works). Tried and I can reply to an existing message

Due to the issues I have sending a message to the forum the attached image is missing and also the code is a bit wrong from the correct one. I have the image attached now.

:Start
      GoSub "OpenWindow"
      GoSub "CloseWindow"
Return

:OpenWindow
     CustomWindow "" "-1" "-1" "Container1" "DialogBox+NoCloseBtn"
Return

:Container1_OnOpen
    GoSub "Count"
Return

:Count
    Loop "1" "1000" "[Count]"
.       Delay "2000"
    EndLoop
Return

:CloseWindow
    CloseCustomWindow "Container1"
Return

:Container1_OnClose

Return

As I already wrote this was only for testing.

The sample In the code was only done for testing, this is the reason that I used a loop to emulate some kind of process. The value of [Count] is shown in the Container1.

The "loading - Process" window is meant to show the user that the Excel file is processed on the moment (this takes several seconds). Same as a lot of applications use "Please Wait".

Thanks a lot

Best regards,

 

Eric Beerhorst

 

Uploaded files:
  • You need to login to have access to uploads.

Hello Gaev,

I did some more tests. Below again the code.
It looks that the sub :Container1_OnOpen, first runs complete 1-1000 (My process emulation) and after that it opens the CustomWindow.

I expected that the CustomWindow would be opened and also the :Count sub would run at the same time and that after the :Count ends the :CloseWindow Sub would close the CustomWindow. This is not true:

  1. The Count loop runs, I see this in the Debugger
  2. The CustomWindow opens, but never closes because the Sub :CloseWindow is never started

The Application Im creating is a quit complex application "reading" excel files with work instructions. Writing the instructions to a SQL database, creating a drawing of the product, TCP/IP communication with workbench etc. The application is 90% ready, and now a simple "please Wait" during processing I cannot find out ;-)

Maybe is my thinking wrong???

 

:Start
      GoSub "OpenWindow"
      GoSub "CloseWindow"
Return

:OpenWindow
     CustomWindow "" "-1" "-1" "Container1" "DialogBox+Exclusive+NoCloseBtn"
Return

:Container1_OnOpen
    GoSub "Count"
Return

:Count
    Loop "1" "1000" "[Count]"
.       Delay "2000"
    EndLoop
Return

:CloseWindow
    CloseCustomWindow "Container1"
Return

:Container1_OnClose

Return

Thanks a lot for your help.

 

Best regards,

 

Eric Beerhorst

 

Uploaded files:
  • You need to login to have access to uploads.

@ebear

Perhaps, CustomWindow is not the best way to achieve your objective (i.e. prevent user from using keyboard/mouse while he/she is shown a Progress Message).

What if (in Design Mode) you had Container1 ...

- placed at 0,0 on the same page as your Button
- the same size as your Pub Window
- in front of all other objects on the page

... then, at run time (startup section) ...

- Hide Container1

... and in your Button code ...

- Show Container1
- Suspend True

... this will prevent user from interacting with your Pub via mouse and keyboard

 

Show progress on Container1, and when done ...

- Hide Container1
- Suspend False

Hello Gaev,

Thanks a lot for your support.

The Idea you wrote in your last response came also up in my mind, but I thought why not with a Custom Window instead of hide, show, resize, front, back etc. of a container.

It's a bit of a pity to archive this in the more complex way.

I changed my code and it is now working.

Thanks a lot,

Eric.

Below the way I did it. I call ":P100_Process_Start" before the start of the Excel Processing, and ":P100_Process_Stop" after the Excel Processing is done. May it can be helping for someone else.

P100_Process_Container, is a transparent container which lays over the Pub, and  P100_ProcessWindow_Container is the small message box "Please Wait".

:P100_Process_Start
    SizeObject "P100_Process_Container" "[PubWidth]" "[PubHeight]"
    MoveObject "P100_ProcessWindow_Container" "([PubWidth]/2)-150" "([PubHeight]/2)-75"
    ShowObject "P100_Process_Container" "Fade" "6"
Return

:P100_Process_Stop
    HideObject "P100_Process_Container" "Fade" "6"
Return