cancel
Showing results for 
Search instead for 
Did you mean: 

Sheet window question

Former Member
0 Kudos

I want to force a MDI sheet window to come to the front and become the active sheet. I have tried to use SetFocus and BringToTop but they don't work.

I have a toolbar with First/Next/Prior/Last buttons and I want to be able to skip through the many sheet windows using the buttons.

Here is the First button code:

lw_sheet = gw_frame.GetFirstSheet()

If IsValid(lw_sheet) Then

   ???

End If

Accepted Solutions (0)

Answers (3)

Answers (3)

arnd_schmidt
Active Contributor
0 Kudos

Hi Roland,

so BringToTop=TRUE  does not work?

MDI related - Sybase: PowerBuilder - Tek-Tips

Outch..

GetFiirstSheet () :

Obtains the top sheet in the MDI frame, which may or may not be active.

So this code brings the mdi sheet window behind the current first sheet to top.


window lw_sheet

lw_sheet = gw_frame.GetFirstSheet()

If IsValid(lw_sheet) Then

    lw_sheet = gw_frame.GetNextSheet ( lw_sheet )

    If IsValid(lw_sheet) Then

        lw_sheet.BringToTop = True

    end if

End If

hth

Arnd

Former Member
0 Kudos

BringToTop works, the problem is the GetFirstSheet & GetNextSheet walk thru the sheet windows in z-order, not open order like I expected.

Former Member
0 Kudos

Roland - When you open the sheet are you keeping an array of window handlers?  If so you can just loop through this instead.

Chris

Former Member
0 Kudos

Good idea. I had thought of that but I ran out of time before the demo. For now they can clickCascade, click the window they want and then click Layer.

arnd_schmidt
Active Contributor
0 Kudos

How about selecting the window from the "built-in"  list of opened sheets in the menu or using <Ctrl>+<Tab> to swtich to the next sheet?

Former Member
0 Kudos

I forgot about CTRL-TAB, thanks.

The menu is hidden and I have a tab control that forms a Ribbon style control.

Former Member
0 Kudos

Yep ... a MS standard since Windows 3.1.  

That is going to make it hard though in your tabbed pane design if someone uses the keyboard standards as tabbing through tab pages is also supported with this keyboard short-cut. So the next thing will be if a user uses the Ctrl+Tab are they changing panes (tab pages) or MDI_Child (sheet) windows?

Food for thought. 

Former Member
0 Kudos

I tested it and the Ctrl-Tab switches the sheet windows. The tabs don't change even if make the tab in focus.

Former Member
0 Kudos

Hi Roland;

  Yes, I stand corrected - you are correct about the Ctrl+Tab behaviour. Tab Pages are controlled via the left / right arrows once a Tab Control has focus.

   I need more Tim Horton's coffee! 

Regards ... Chris

Former Member
0 Kudos

Roland,

lw_Sheet.BringToTop = True should work. Did you check to see if first sheet is indeed the sheet you would expect? Was the sheet window opened using OpenSheet?

Former Member
0 Kudos

It looks like GetFirstSheet is the same as GetActiveSheet. I was expecting it would be the first one opened. GetFirstSheet and GetNextSheet go in z-order, not opened order which means the buttons will just jump between the two top most windows.

Former Member
0 Kudos

This is interesting. Even I was under the impression that the stack would would be in the order in which the sheets were opened and GetFirstSheet would give the first sheet on the stack. But we are wrong. PB help says that GetFirstSheet will return the sheet on the top (which may or may not be the current sheet) and GetNextSheet will get the sheet after whatever sheet you specify.

In your case you need to somehow push the previously active sheet to the bottom of the stack.

If you are using PFC, then iterate thru the sheetmanager.inv_sheet array.

Former Member
0 Kudos

I was working on an GUI concept demo that will be used to upgrade an existing PFC app. If the new concept is accepted, I could look into using sheet manager.

Former Member
0 Kudos

OpenSheet again on the sheet you want active - I think should work.