Wish : List of open Windows in an Application

Wish : List of open Windows in an Application

Postby anserkk » Thu Dec 04, 2008 10:22 am

Dear Mr.Antonio

I am not an expert in FWH. Correct me, if I am wrong

Is there any solution to get a list of open windows/dialogs in a particular application.

There are many situations where when one would require to have such a list while programming in an MDI environment.

Eg. No 1: In my application (MDI enviornment), there is a menu option named "Change working Financial Year", so that my user can change working Financial year. When the user selects this option, I should confirm that no other windows are remaining open in my application.

Eg. No 2: Data Re-indexing option, there should NOT be any open windows (DBF) when the user do the Re-indexing process. Here also I should be able to check whether there are any open windows/dialogs

At present I am handling the above situations by using an Application Class and I am keeping an array DATA in it.

Whenever I create a new Window or Dialog I add few informations to this array and whenever I close the Window/Dialog, I delete the information from the array

Some of the details stored in this array are:-

1. Type ie Window or Dialog
2. Title of the Window/Dialog
3. hWnd of the Window/Dialog

I make use of this class to solve the above said Issues

For Eg.

Code: Select all  Expand view  RUN
nOpenWindCount:=Len(oApp:aOpenForms)


If I want to close a particular Window/Dialog, I can loop through the array and get the Window/Dialog Tile and then close.

But if I ever miss to Add or Delete information to this Array in the Application class, then I get undesirable results.



Regards

Anser
Last edited by anserkk on Thu Dec 04, 2008 12:19 pm, edited 1 time in total.
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby pymsoft » Thu Dec 04, 2008 10:51 am

Anser:


Try this: (Win Progress is my application, caption in main window)


Code: Select all  Expand view  RUN

IF FinAperte() = 0
  ReindexMyDB()
ENDIF


********
FUNCTION FinAperte()
********
LOCAL aWindows, cTxt, i
LOCAL nCount := 0

  aWindows := getallwin()

  for i := 1 TO LEN( aWindows )
    if valtype( aWindows[i] ) = "O"
      IF !EMPTY( aWindows[i]:cCaption )
        IF AT( "WIN PROGRESS - ", aWindows[i]:cCaption ) = 0
          nCount++
        ENDIF
      ENDIF
    endif
  next

RETURN nCount
*
** eof FinAperte



regards
Pedro Gonzalez
User avatar
pymsoft
 
Posts: 383
Joined: Tue Oct 11, 2005 1:01 pm
Location: Savona - Italia

Postby anserkk » Thu Dec 04, 2008 12:11 pm

Dear pymsoft,

This is what I needed. You have been a great help to me.

I hereby correct the statement which I have made in my above post.

FWH already have these functions.

Regards

Anser
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to To do - WishList / Por hacer - Peticiones

Who is online

Users browsing this forum: No registered users and 4 guests