1. JOSE WILLIAM ROMERO OLIVOS
  2. PowerBuilder
  3. Tuesday, 4 July 2023 22:37 PM UTC
Good morning Dear Sirs.

On some occasions, the Windows regional configuration is shared with other applications, which have a different regional configuration and are sometimes affected.


Is it possible for my app in powerbuilder 2022 to set my own locale by code or in my app?

Thank you


William

Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 5 July 2023 07:00 AM UTC
  2. PowerBuilder
  3. # 1

Hi.

In the past, there was a client who needed our application to run with some regional settings altered. For example: they wanted to use as decimal separator "." instead of "," which is the default in Greek regional settings. But they wanted this change to happen only in our application.

Before mentioning how we achieved that, I will mention that most applications read those settings when they are initially loaded. As a result if those settings change while a powerbuilder application is running, from what we experienced, powerbuilder application ins't aware of those changes.

As a result, we built a small exe which did customized regional settings (altering registry) and right away called (using run command) our main application. Our main application was reverting those changes back to original settings (altering again registry), but as it was already launched it wasn't affected by that change.

I don't know what regional settings you need to modify for your application. Depending on what you need to do, what we did may or may not work for you.

Andreas.

Comment
  1. Sivaprakash BKR
  2. Wednesday, 5 July 2023 10:49 AM UTC
Yes, without knowing the what you want to change in regional settings, it might be difficult to suggest one.

We used to have our own date (display & edit) format, amount (decimal) display format, which will work only in our application. We didn't change the windows Regional settings for this instead set the required format for all fields that needs this.

  1. Helpful
There are no comments made yet.
JOSE WILLIAM ROMERO OLIVOS Accepted Answer Pending Moderation
  1. Wednesday, 5 July 2023 13:24 PM UTC
  2. PowerBuilder
  3. # 2
Thanks for the reply.

The changes I want to make are in number format, currency format, and date format.

But I would like to be able to tell my app what the format is and not take the Windows one. That saves me windows configuration issues and avoids problems with other desktop applications that need different regional configuration.

Is there a way to do it without modifying the registry?
Comment
  1. John Fauss
  2. Wednesday, 5 July 2023 18:09 PM UTC
The concept of selecting regional-specific settings in Windows is based on the premise that a Windows user selects the settings that are to be used across ALL applications. Windows does not support application-specific regional settings, by design.
  1. Helpful
  1. Roland Smith
  2. Wednesday, 5 July 2023 18:29 PM UTC
The most straight-forward way would be to create formatting function objects for the various datatypes and always call them instead of relying on the String function. The DataWindow EditMask will have to be set to string type and might not work as you want. You'd have to try it yourself.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 5 July 2023 19:44 PM UTC
Hi John / Roland;

FYI: That is what I do in my STD framework ... the App is always assuming English but when run in other languages that it supports, the framework uses the objects of that language that have are tailored descendants that implement the language variations (ie: Display Format, Edit Format, Tool-tips, etc). ;-)

Regards ... Chris
  1. Helpful
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Thursday, 6 July 2023 08:18 AM UTC
  2. PowerBuilder
  3. # 3

Here is the screenshot where we used to get the format(s)

One can choose the format for required fields in this screen.   These values are stored in database, which will be retrieved on application start up and applied wherever required.   We have an event for that in ancestor window.  In that event, in child window, we code like this

dw_list.Modify('insertdate.editmask.mask = "' + ls_datetime_editmask + '"')
dw_list.Modify('insertdate.editmask.useformat = "yes"' )
dw_list.Modify('insertdate.format = "' + ls_datetime_format + '"')

dw_entry.Modify('openingdebit.format = "' + ls_decimal_format_screen + '"')
dw_entry.Modify('openingcredit.format = "' + ls_decimal_format_screen + '"')

Here we never touch the registry or windows settings.   

HTH

Happiness Always
BKR Sivaprakash

 

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.