PB11 WebForm方式下messagebox的本地化处理

 
 PB11 在 web form 下毕竟工作方式有很大区别,使用过程中发现很多的对话框窗口已经不再调用操作系统的底层函数来实现了,其中最有影响的当属messagebox函数,虽然屏幕上显示这样的提示:
 
按钮文字是英文的看起来也不是非常难受,但给用户使用时,总感觉美中不足。为次,多次上到sybase newsgroup寻求解决方案,但最后还是否定了从PB版本上的直接解决方法。以下是我从新闻组上交流到的信息(后者前先者后):
 
Jim O'Neil:
You're going to use a binary editor on a DLL shipped with
PowerBuilder???  I don't even think .NET would let you do that as it
would be a security breach if the assembly were tampered with -
assuming you could even figure out WHAT to change.
DJ posted a quite viable workaround for you, I would recommend that.
In terms of the other 'system dialogs' that are also not
culture-aware, I supposed the job would be bigger/harder.
 
DJ Huang:
No I am not suggesting to change the DLL or implementation internal to PB11.
I do ask you to write a modal PB window with OK/Cancel button or other
command buttons, to mimic MessageBox look-and-feel
On 1 Mar 2007 03:44:14 -0800, qland <qland@vip.sina.com> wrote:
>Hi "Jim O'Neil
>
>In which DLL file is the function of implementation messagebox ?
>
>I can change text to chinese if I know the DLL file.
>
>>probably obvious given the context) and the implementation is
>
>On 28 Feb 2007 06:50:11 -0800, "Jim O'Neil [Sybase]"
>< joneil_@_sybase_dot_com> wrote:
>
 
DJ Huang:
qland/Jim,

If the Engineering team has no quick solution, then you can try this work
around:

Create your own POwerBuilder window, type = response window, with a few
buttons to simulate the messagebox.  Then call your own MessageBox()
function.  A meesageBox function in your class will hide the system build-in
messagebox when you call within that class

>>The Web Forms generation is not using the underlying MessageBox (as is
>>probably obvious given the context) and the implementation is
>>currently such that you will only see English text.    My
>>recommendation would be to submit a case under the beta program so
>>that it gets into our system.  If you think this is fundamental to
>>being able to use the product to build applications, you might include
>>a note to that effect in your case notes, so the appropriate priority
>>can be given.
>>
>>On 27 Feb 2007 21:21:28 -0800, qland < qland@vip.sina.com> wrote:
>>
>>>
>>>Thank Jim O'Neil
>>>
>>>Some diaglogs like GetFileOpenDialog, GetFolder, etc. have this same
>>>problem, texts of displaying  is english.
>>>
>>>my environment is:
>>>
>>>Windows XP sp2 chinese version
>>>IIS 5.0
>>>my machine is Server and Client
>>>
>>>but it's ok if running smart client app by calling :
>>>
>>>#IF Defined PBDOTNET Then
>>>    System.Windows.Forms.MessageBox.Show ("This message is from .net")
>>>#END IF
>>>
>>>The text of "OK" button is chinese
>>>
>>>
>>>Thanks
>>>
>>>
>>>On 27 Feb 2007 05:01:53 -0800, "Jim O'Neil [Sybase]"
>>>< joneil_@_sybase_dot_com> wrote:
>>>
>>>>The MessageBox function will use the machine's OS in order to
>>>>determine the text of the buttons NOT the culture info.  There are
>>>>several posts you can find in Google on this.  The underlying cause is
>>>>that the .NET MessageBox.Show calls the Win32 MessageBox and the
>>>>latter is not culture-aware.
>>>>
>>>>With that said though, if you see Chinese text for the buttons in PB
>>>>Native Mode on the same machine that hosts IIS, then I would conclude
>>>>that machine IS running Chinese Windows.  In that case, I  the
>>>>MessageBox you see generated for WebForms should reflect the same
>>>>behavior, and what you are reporting should be considered a bug.
>>>>
>>>>I had sent a note into engineering about your question earlier, and
>>>>will follow up with them.  I'd be curious if other system dialogs -
>>>>like the GetFileOpenDialog, GetFolder, etc. have this same problem?
>>>>
>>>>
>>>>On 27 Feb 2007 04:07:37 -0800, qland < qland@vip.sina.com> wrote:
>>>>
>>>>>
>>>>>Thanks.
>>>>>
>>>>>I change PBCultureSource property on the configuration tab to "client"
>>>>>or to "server", the result is the same as shown in figure
>>>>>
>>>>>but it's work fine under PB app native mode.
>>>>>
>>>>>On 26 Feb 2007 08:43:04 -0800, "Dave Fish [Team Sybase]"
>>>>>< dfish@_no_spam_sybase.com> wrote:
>>>>>
>>>>>>Actually that is available in the latest engineering drop (build
>>>>>>6056). It is the PBCultureSource property on the configuration tab. By
>>>>>>default it is set to Server. I'm not sure that it would change
>>>>>>anything in this situation though. I believe message boxes get
>>>>>>converted to Javascript alerts so there may be a way to modify the
>>>>>>generated Javascript for the application if the PBCultureSource
>>>>>>property doesn't handle this.
>>>>>>
>>>>>>Regards,
>>>>>>Dave Fish
>>>>>>Sybase
>>>>>>
>>>>>>On 26 Feb 2007 08:34:21 -0800, "Jim O'Neil [Sybase]"
>>>>>>< joneil_@_sybase_dot_com> wrote:
>>>>>>
>>>>>>>Does the language of that button not reflect the server language?  I'd
>>>>>>>suggest that is a bug, or at the very least a limitation that needs to
>>>>>>>be documented.
>>>>>>>
>>>>>>>The next beta drop will have a 'culture' property that *may* address
>>>>>>>this.
>>>>>>>
>>>>>>> On 26 Feb 2007 07:47:08 -0800, qland < qland@vip.sina.com> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>Hi all
>>>>>>>>
>>>>>>>>In webform app,
>>>>>>>>
>>>>>>>>Is there any way to change the button's text language(i.e. chinese )
>>>>>>>>in the messagebox
>>>>>>>>
>>>>>>>>Thank
>>>>>>>>
>>>>>
 
所以,最后我按DJ Huang的建议,自己使用PB对象来解决了,下图就是新的结果,基本上实现了原来messagebox函数的所有功能,但无法做到后面3个参数的缺省调用。
 
调用方式还是与原来的messagebox函数类似:
calling this function like this:
    messageboxx('prompt','information', icontype, buttonname, default)

fox example:

messageboxx('error?,'aaaa~r~nbbbbbbbb',Exclamation!,AbortRetryIgnore!,2)
》》》》 messageboxx function
  There is no heavily overrided messagebox in order to keep the original messagebox function.
---------------------------------------------------
global type messageboxx from function_object
end type

forward prototypes
global function integer messageboxx (string as_title, string as_info,
icon aic_type, button abt_type, integer ai_default)
end prototypes

global function integer messageboxx (string as_title, string as_info,
icon aic_type, button abt_type, integer ai_default);s_messagebox
str_recv
integer li_rtn
str_recv.as_title = as_title
str_recv.as_info = as_info
str_recv.aic_type = aic_type
str_recv.abt_type = abt_type
str_recv.ai_default = ai_default
openwithparm(w_messagebox, str_recv)
li_rtn = message.DoubleParm
return li_rtn

end function
越来越喜欢PB11的WebForm了,现正在将原来OA中的某些业务逻辑比较复杂的功能采用PB11实现。
 2007-3-12 附加一副PB11做的简单程序的界面:
               
               
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值