1. ATK Gimmy Susan
  2. PowerBuilder
  3. Sunday, 24 May 2020 18:23 PM UTC
Hi everybody,

I am trying to set background of my mdi style window with a picture.

When I try to do this using picture object, I can not see child windows
opened in this mdi frame.

If anybody tells me ways to do this I will be glad.
The idea is to have a wallpaper.
 
Thanks
Accepted Answer
Olan Knight Accepted Answer Pending Moderation
  1. Sunday, 24 May 2020 20:45 PM UTC
  2. PowerBuilder
  3. # Permalink

We do the following:

In the ancestor OPEN event of the mdi_frame window of the application:

// Open Bkg window
OpenSheet(w_bkg,this)
il_wbkg_w = w_bkg.width
il_wbkg_h = w_bkg.height

this.FUNCTION of_center_wallpaper ()

Where:
w_bkg = a child window inherited from w_master, located in the Class Library, in our case in CORP_PFE.
this      = w_app_frame, inherited from w_frame.


// We wanted to keep the code generic when centering the wallpaper in case the image changed.
integer wx, wy, wh, ww


// Get current MDI workspace
wx=this.workspacex ( )
wy=this.workspacey ( )
wh=this.workspaceheight ( )
ww=this.workspacewidth ( )

// Set background image
If ( handle (w_bkg) > 0 ) then
     wh -= 200        // Approx Microhelp Height??
     w_bkg.width=il_wbkg_w
     w_bkg.height=il_wbkg_h
     If ww>w_bkg.width Then
         ww = Integer((ww - w_bkg.width) / 2)
     Else
         ww = 1
     End If
     If wh>w_bkg.height Then
         wh = Integer((wh - w_bkg.height) / 2)
     Else
         wh = 1
     End If
     Move(w_bkg, ww, wh)
End If

// Be sure focus is on us and not the background image
SetFocus(this)



Later -

Olan

Comment
  1. Chris Pollach @Appeon
  2. Sunday, 24 May 2020 21:13 PM UTC
The problem you'll have now is when a) there are many toolbars ( you can have up to 12 toolbars on an MDI app) & now users can have a ribbonbar as well. So that makes MDI_1 management a real challenge. However, no issues using a floating child window with a picture image. Food for thought. ;-)
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Sunday, 24 May 2020 19:37 PM UTC
  2. PowerBuilder
  3. # 2

Hi Gimmy;

   That's rule #1 of the seven rules of "how not to mess up an MDI app / frame". No controls on the surface of an MDI frame as Michael correctly states, it interferes with MDI_1 which controls the MDI Child objects at runtime.

    While you can try what Michael suggests, you have to make sure you get the resizing of MDI_1 perfect otherwise your app will look weird, no sheets (MDI child windows) will show or you'll just GPF (worst case).

    Personally, I'd just float a child window in front of the MDI frame and hide / show it when sheet windows are or are not present. Much safer IMHO.  Just my $0.02. HTH

Regards.... Chris

 

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Sunday, 24 May 2020 18:57 PM UTC
  2. PowerBuilder
  3. # 3

MDI Frame only auto-resizes its MDI client area when there are NO other controls on the MDI frame.

Add a picture to the MDI Frame => That frame's built-in control named MDI_1 remains sized (0, 0) at position (1, 1).

So you have to add code to the Resize event. Note also, user can move MDI toolbars around. You therefore have to adjust for toolbar when resizing + moving MDI_1. Look at code in PFC or another framework for inspiration on how to position MDI_1 correctly.

HTH /Michael

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.