PxPlus User Forum

Twitter Twitter Twitter

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mike King

Pages: 1 2 [3] 4 5 ... 65
31
Language / Re: Switching an existing extended ASCII based system to UTF8
« on: January 17, 2024, 12:28:52 PM »
While PxPlus does support UTF8 there are a significant number of things you need to consider and potentially change.  Here are a few of the major issues.

Field Separator:

One of the largest issues you will face is that the default field separator used by PxPlus is hex 8A.  This dates back to the original Business Basic from MAI and has been maintained over the years to avoid clients having to rebuild their existing files and to avoid existing logic that looks for $8A$ having to change.

The first thing you should do if you are going to use UTF-8 is to change the default field separator to a character in the range of $00$ thru $1F$.  Ideally avoid tab ($09$), LF ($0a$) CR ($0D$) and ESCAPE ($1b$) as these could cause long term problems when accessing text.

Data Files:

You will also need to convert ALL existing data file which may have text requiring UTF-8.  Basically, this is any file which might contain accented characters.  Files that use standard ASCII ($00$ thru $7F$) wont need migration however their field separators will need to be reloaded.

Different length data:

When using UTF-8 data length can vary.  For example, in normal extended ASCII 6 characters takes 6 bytes.  Consider the word “garçon”, this would require 6 bytes in normal ASCII but seven in UTF8.  So, if you used this as a key to a file you would need to make sure you allocated 7 bytes for it, and if there were multiple accented characters the key size would need to be longer.

Also, in your code if you try to replace portions of string you need to consider that length of a string to display may not be the same as the length of a string in memory.  This can cause problems with existing code.

Substrings also pose a challenge.  For example, if you decided that the first 4 bytes of a name was to be used as some form of code.  If the name had a UTF code sequence that started at byte 4 and continued thru byte 5+, taking a substring would likely result in an invalid UTF8 sequence.

I short, it is doable and all the tools you need are in PxPlus but migrating an application that wasn’t originally designed to handle multi-byte character is a challenge and involves more than just a character set change and system option setting.


32
Webster Plus / Re: short code [list]
« on: January 17, 2024, 12:10:26 PM »
I haven't checked but it looks like you are missing the trailing separator.
I think it should be:

[list Cars$][data rowsep=/]Ford/Gm/Audi/Volvo/[/data][/list]


33
Programming / Re: From It run program - debug window too short
« on: January 09, 2024, 11:56:05 AM »
When you run a program from within IT using F7, the menu Debug >> Debug current program, or the menu option Run >> PxPlus the system will spawn a new instance of PxPlus using the default window size.  The default consists of an 80x25 window inside a window frame container whose dimensions is set in your INI file in the [WindowFrame] section.

Generally I suggest that you override these by providing a START_UP program that sets whatever you want as a minimum window size by calling *cmd/system/wdw and passing the size desired as WWxHH (e.g. "100x30").  This will create the base window the size desired, however you will still need to adjust the outer frame size to suit your needs.

You could also try adding the following commands to your START_UP:

CALL "*cmd/system/wdw", "100x30"  ! Or whatever your desired minimum cols/lines might be
CALL "*cmd/system/wdw", "zoom auto"


This will tell the system to create a 100x30 window then adjust the font size so you end up with the desired window size (in terms of columns/lines) within the frame and to tweak the frame size to match the window size.  The auto option enables tracking any frame size adjustments made by the user and have the system adjust the font accordingly.

34
Thin Client/WindX / Re: Auto Updater
« on: December 19, 2023, 11:27:31 AM »
Assuming you just need the standard WindX plugin updated in the standard location you could have whatever version of WindX currently is installed download the desired WindX installer then run it.

By default each version installs in a different directory so you can install a newer version from any existing version. 

Now you would need to make sure the user knows you are doing this so they let the install take place and haven't disabled remote shell requests, although you might consider running the installer silently if you felt that worked better for your application.

Once installed have the old WindX change whatever desktop shortcut is used to launch WindX on the users workstation using Wscript.shell.


35
Programming / Re: Memory leak? Something not being freed?
« on: December 15, 2023, 12:32:46 PM »
To see what you have open, on Windows click on the icon in the upper left (or press ALT-SPACE) then select About PxPlus.  From there select the info button.  This will show you all files, windows, controls and object you are using.

Also, to avoid unwanted left over objects, always consider adding a FOR clause when creating an object with the NEW function which will allow you set dependencies on the new object which will allow for automatic deletion.  For example if the object is only used in a subroutine while its active you could add FOR PROGRAM.

36
Wish List / Re: string interpolation
« on: December 14, 2023, 11:46:40 AM »
Actually here is a simple object that you can use to accomplish what you are looking for:

Code: [Select]
  def class "string"
  function perform Eval$(string$)
  local _.x$,_.o
  enter (_.x$)
  _.o=pos("\"=_.x$)
  if _.o \
   then _.x$=sub(_.x$,"\{",$01$);
        _.x$=sub(_.x$,"\}",$02$);
        _.x$=sub(_.x$,"\"+quo,$03$)
 !
  translate _.x$,"{"+chr(6)+"""+STR("+"}"+chr(3)+")+"""
  _.x$=evs(quo+_.x$+quo)
  if _.o \
   then translate _.x$,$01$+chr(1)+"{"+$02$+chr(1)+"}"+$03$+chr(1)+quo
  return _.x$
  end def

Basically you can pass it a string with values/expressions to expand surrounded by curly braces.  If you want to input actual curly braces or a quote in the output string, prefix them with a backslash.  For example:

->name$="Tom"
->o=new("string")
->print o'Eval$("Hello, {name$}! Today is {day}")
Hello, Tom! Today is 12/14/23


If the string has an error such as unmatched curly braces or a invalid value/expression the error will be returned to the caller.

37
Programming / Re: Multi-Line SELECTOFFSET, SELECTLENGTH, SELECTTEXT$
« on: December 11, 2023, 11:00:52 AM »
Oh and if you really want to use a single line input and have access to 'SelectOffset, 'SelectLength, etc., use a POPUP menu on the control.

Windows will NOT clear the selection if you right click to invoke the popup menu for the control so in your popup menu logic you can access the selection information.

This is how Windows handles this -- Anything looking to access the selected text generally does so from a Right click popup especially when dealing with single line input fields.

38
Programming / Re: Multi-Line SELECTOFFSET, SELECTLENGTH, SELECTTEXT$
« on: December 11, 2023, 09:58:51 AM »
What you are seeing is normal Windows behavior. 

For example if you run any windows application and ask it to open a file, then in the file name field (a single line entry field) enter your text "Hello World Canada", select the second word and press tab to exit the field, you will see that the selected text get automatically unselected.

Only multiple line inputs preserve the selected text in Windows.

39
Programming / Re: Monitor in Portrait Mode can't Maximize
« on: November 23, 2023, 10:47:18 PM »
There is a limit as to the number of lines high a window can occupy.  These limits changed in PxPlus 2021.  What version are you running?

40
Programming / Re: DEF OBJECT WORD
« on: November 07, 2023, 08:48:22 AM »
Version 9 is over ten years old and not supported.  Add to that DDE itself is not technology that Microsoft promotes anymore.

We would suggest you upgrade to a more recent/supported release.  This would allow you to use our interfaces to both Word and Excel.

41
Programming / Re: More Advanced Search Tool Than Integrated Toolkit
« on: November 06, 2023, 09:10:57 PM »
You probably should review Regular Expressions ..

Basically for what you want would be

DIM.*MYVAR

Here is a link to more details about regular expressions which are used by the MSK function:
https://manual.pvxplus.com/page/functions/msk.htm

42
Programming / Re: Link File vs. Prefix File
« on: August 22, 2023, 10:33:12 PM »
Prefix file is a bit less overhead, however link files are often easier to manage and allow you to use the PREFIX directive to control which database you may want to access.

43
Programming / Re: Create an Excel file in Linux environment
« on: August 11, 2023, 08:57:50 AM »
You can find more information about using zip files with PxPlus at

https://manual.pvxplus.com/page/PxPlus%20User%20Guide/File%20Handling/Processing%20Data%20Files/Accessing%20ZIP%20Files.htm

Support for Zip files was added in 2014.

44
Programming / Re: Create an Excel file in Linux environment
« on: August 10, 2023, 04:31:39 PM »
And since PxPlus itself can read/write ZIP files all you really need to do is open the ".xlsx" file directly and treat it as a Keyed file to READ/WRITE the records directly where the keys are the embedded file pathnames.

For example:

->open (1) "test.xlsx
->print key(1)
[Content_Types].xml
->read record (1) r$
->?r$
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/
vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/
workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl
/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override Part
Name="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/xl/styl
es.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStr
ings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/><Override PartName="/doc
Props/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml
" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>
->print key(1)
_rels/.rels
->read record (1) R$
->print r$
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId3" Type="http://schema
s.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId2"
Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relat
ionship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook
.xml"/></Relationships>

Given this you should be able to parse any XLSX file and potentially create new ones.

45
Programming / Re: Accessing a Control on Another Dialog
« on: August 09, 2023, 09:03:36 PM »
It likely would be easier to just use Pseudo control handles.  You can use the *system object to get the handle for any control in the system and then use it anywhere to access the control. 

https://manual.pvxplus.com/page/objctl2/overview.htm

->button 10,@(10,10,10,10)="hello
->osys=new("*system")
->%Btn_handle=osys'Control(10)
->?Btn_handle
 1000100010

Pages: 1 2 [3] 4 5 ... 65