MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

How to Set up Image/Logo/Welcomepage on MDI Frame Main Window In PowerBuilder

Published on 21 June 20
0
0

In PowerBuilder PFC Framework if we try to insert a image or any control on the main frame window, we need to write code for resize for every other sheet window. So it is very difficult to insert an image or object in the main frame window. But as a company many want to show logo or image of their company/brand or want to show some welcome page on PowerBuilder applications.

The below technique will help to achieve this.

Create a Window With Image/logo/Objects inserted in it

1/ Window Type : Child , State : Normal , Visible and Border only Checked in the General Properties. Name it as w_logo

2/ Insert Picture Object --> Name : p_1, Select Pictue you want to insert into that , Visible and Enable only checked in general, other properties are default

In my case I am using a picture you can use your own picture or text whatever you want

3/ In resize event I am setting the picture height and width to the window's height and width

p_1.height = this.height p_1.width = this.width

Main frame window

1/ Create a frame window w_frame_main of mdihelp! type and m_usermenu(your choice)

open this in application open event

open(w_frame_main)

2/ create 2 instance variables to use width and height of the w_logo window

Integer ii_wbkg_w Integer ii_wbkg_h 

3/ Create a user defined event - ue_mdi_move with (None) return Type and no event id is selected . Write below code in that -

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_logo) > 0 ) then wh -= 200 // Approx Microhelp Height?? w_logo.width=this.workspacewidth ( ) w_logo.height=this.workspaceheight ( ) If ww>w_logo.width Then ww = Integer((ww - w_logo.width) / 2) Else ww = 1 End If If wh>w_logo.height Then wh = Integer((wh - w_logo.height) / 2) Else wh = 1 End If Move(w_logo, ww, wh) End If // Focus is on this and not the background SetFocus(this) 

4/ In the open event of the w_frame_main

OpenSheet(w_logo, this) ii_wbkg_w = w_logo.width ii_wbkg_h = w_logo.height triggerevent("ue_mdi_move") this.setmicrohelp( "Welcome!") 

5/ in the resize event of the w_frame_main window

TriggerEvent("ue_mdi_move")

Thats It! Enjoy and let me your experience :)

Happy coding!

Long Live PowerBuilder!

Related Posts:
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
 
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top