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
Programming / Re: How to send a POST request using *BROWSER
« on: January 24, 2024, 01:24:12 PM »
In your logic where you issue the Navigate2 call, what is happening with the resultant response?

If you simply want to submit the posted data and are planning on throwing away the response or at least not displaying it the *plus/web/request is likely all you need.

However, if you are expecting a response of a web page you wish to display so the user can continue then you likely will need to create some JavaScript and HTML to load into *browser so that it can post the data.

Alternatively you might be able to blend these so you make the request using *plus/web/request then pass the resultant response to *browser for it to display.  This may work however if the response includes things such as cookies it likely will fail.

Now all that being said, if the data is basically form fields it may be possible to simply include them in the URL.  Often applications won't care if data comes from the URL (i.e. http: //somesite.com?field=xxx&field2=yyy) or from posted data.  So if you are simply emulating the user entering fields on a form, try appending the desired data on the URL you pass to navigate2.


32
Assuming all you want to do is bleed through a solid background color and not an image or graphic, just create a multi-line and set its background color to the same as the window and pick a text color that assures the user will be able to see what they type.

PxPlus doesn't support bleeding through a background image on an input field.

33
Programming / Re: How to send a POST request using *BROWSER
« on: January 23, 2024, 04:26:15 PM »
What are you actually trying to do?

*browser will allow you to display a web page from which the user could fill in controls and have the data POSTed to a server with the results being a new/updated web page.  There's a lot of other options here if you want to learn JavaScript and use things like AJAX.

You asked how to POST data, which is what *plus/web/request will allow you do.  Basically you create the data to be POSTed then using this routine you can forward the data to a URL and receive a response for processing.

 

35
Webster Plus / Re: short code [list]
« on: January 18, 2024, 08:48:43 AM »
There are a number of ways to create HTML using PxPlus that don't require much knowledge of HTML itself.

I personally use the PxPlus HTML editor (*htmledit) if I want to design the screen myself.  It has menu options to insert Webster short odes.  Basically just start the editor and enter the short codes. No HTML coding required.

You can also use the file maintenance generator to create forms based on file definitions.  It can make general maintenance screens which you can customize or inquiry screens which provide basic layouts that you then add events to. 

Using the section and row short codes allows you to create responsive screens without much work.

36
Webster Plus / Re: short code [list]
« on: January 17, 2024, 12:48:34 PM »
I just did a test and the trailing slash is not required (although it probably should be there).

Using PxPlus 2023 the following web page worked for me with or without the trailing separator.

Code: [Select]
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="Mike King" />
</head>
<body>
[ttl]Cars[/ttl]<br>
<p>[form program=myprog]</p>
[list Cars$][data rowsep=/]Ford/Gm/Audi/Volvo/[/data][/list]
<br />
[list Cars2$][data rowsep=/]Ford/Gm/Audi/Volvo[/data][/list]
[/form]
</body>
</html>

37
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.


38
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]


39
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.

40
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.


41
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.

42
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.

43
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.

44
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.

45
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?

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