Jul 4, 2012

Powerbuilder - Custom Messagebox

1. Create a Response window named w_msg with 1 static text and 3 command button.


2. w_msg event open

 string ls_data,ls_parse  
 integer li_loop,li_count  
 ls_data = message.stringparm  
 for li_loop = 1 to len(ls_data)  
      ls_parse += mid(ls_data,li_loop,1)  
      if right(ls_parse,1) = ',' then  
           ls_parse = left(ls_parse,len(ls_parse) - 1)  
           li_count++  
           choose case li_count  
                case 1  
                     st_msg.text = ls_parse  
                case 2  
                     cb_1.text = ls_parse  
                case 3  
                     cb_2.text = ls_parse  
                case 4  
                     cb_3.text = ls_parse  
           end choose  
           ls_parse = ''  
      end if  
 next  

3. cb_1 event clicked

 closewithreturn(parent,'1')  

4. cb_2 event clicked

 closewithreturn(parent,'2')  

5. cb_3 event clicked

 closewithreturn(parent,'3')  

6. Create Global Function named f_message

 global function integer f_message (string as_text, string as_option1, string as_option2, string as_option3);  
   
 string ls_return,ls_parm  
 ls_parm = as_text+','+as_option1+','+as_option2+','+as_option3+','  
 openwithparm(w_msg,ls_parm)  
 ls_return = message.stringparm  
 return integer(ls_return)  
   
 end function  
   

7. Call Your Custom Messagebox

   
 int li_option  
 li_option = f_message('Web Browser are you using','Chrome','Firefox','Internet Explorer')  
 choose case li_option  
      case 1  
           //Chrome  
      case 2  
           //Firefox  
      case 3  
           //Internet Explorer  
 end choose  


8. See Them in Action



9. Cheers.. :D

2 comments:

  1. Download Source Code from 4shared :

    http://www.4shared.com/zip/gaZ_QZEJ/CustomMessagebox.html?

    ReplyDelete
  2. Please checkout my Powerbuilder channel & visit my blog that you can download PowerBuilder Stuff, Ayo jangan ragu :

    https://www.youtube.com/channel/UCbn3GqvzKeneDQuy8JvoSIQ?sub_confirmation=1

    https://zulmach.wordpress.com/

    ReplyDelete

Are legacy 4GL applications keeping you from embracing modern technologies?

As the competitive advantages offered by cloud, mobile, and other new technologies become more apparent, the decision to migrate legacy 4GL ...