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 - RobL

Pages: [1] 2
1
Programming / Re: list_box with line borders or alternate colors?
« on: January 18, 2023, 08:40:08 AM »
Hi,

I think the ‘BackHiLight1$ property is what you’re looking for. Here’s a link to to the page in the docs:
https://manual.pvxplus.com/PXPLUS/properties/backhilight1_.htm

Regards,
Rob Leighton
Riverwood Enterprises Inc.

2
Programming / Re: Excel Spreadsheet Column Options
« on: September 01, 2022, 12:40:01 PM »
Hi Ron,

I found useful information here: https://docs.microsoft.com/en-us/office/vba/api/overview/excel. I've also found examples here on the forum and the old mailing list as well as googling for examples of Excel VBA code and then trying to convert the solutions to PxPlus.

Rob

3
Programming / Re: Excel Spreadsheet Column Options
« on: August 30, 2022, 06:24:22 PM »
Hi Ron,

I don't see a property or method of the *obj/excel object you could use to change the cell format, but there is the 'Excel property that give you access to the properties and methods of the Excel object.

The following works for me (PxPlus 2022 Windows):

begin
xl=new("*obj/excel")
wb=xl'OpenWorkbook("ExcelSS.xlsx")
ws=xl'SetWorkSheet("Sheet1")
xl'Excel'Columns("A")'NumberFormat$="@" ! set column 1 to text
xl'SaveWorkbook()
z=xl'CloseWorkbook(1)
drop object xl
end

Hope this helps!!

Regards,

Rob Leighton

4
Hi James,

I get the same result as you do, but here's something interesting.

The following code doesn't work:
Code: [Select]
begin
!
dim Fld$[*]
read data from "Mike,Was,Here",sep="," to Fld${all}
print Fld$[1]," / ",Fld$[2]," / ",Fld$[3]
-:end
-:run
Mike /  /
-:

But, with the addition of a line that prints the array elements, it does.
Code: [Select]
begin
!
dim Fld$[*]
print Fld$[1],Fld$[2],Fld$[3]
read data from "Mike,Was,Here",sep="," to Fld${all}
print Fld$[1]," / ",Fld$[2]," / ",Fld$[3]
-:end
-:run

Mike / Was / Here
-:

I'm not sure why printing these elements is causing them to be created in the array, but that seems to be what's happening.

Consider the following:
Code: [Select]
begin
dim Fld$[*]
for z=1 to 3
print Fld$[z]
print dim(read num(Fld$))
next
-:end
-:run

 1

 2

 3
-:

Regards,

Rob Leighton

5
Pardon me jumping in..

Try loading the dynamic array like this:
Code: [Select]
Rec$="ZZZ"+sep+"YYY"+sep+"XXX"+sep
!
dim Fld$[*]
for element$ from Rec$
Fld$[*]=element$
next
!
print sub(rec(cpl("iolist Fld${all}")),sep,",")

Hope this helps!

Regards,

Rob Leighton

6
Language / Re: Load Edit Keys 'EL'
« on: July 01, 2021, 02:18:49 PM »
Hi Skip,

Does the following work for you?

begin
print 'EL',"2",chr(9),$02$,"Y"+$0D$,
input "Do you wish to continue?: <Del>='Y': ",answer$
print "You entered ",answer$

I tried this on PxPlus 17.10 Windows and it seems to work correctly.

Regards,

Rob Leighton
Riverwood Enterprises Inc.

7
Nomads / Re: Displaying an Excel spreadsheet on a NOMADS panel
« on: June 06, 2021, 03:22:59 PM »
Hi Stéphane,

Thank you for the reply! You've given me somewhere new to start looking/Googling.

Regards,

Rob

8
Nomads / Displaying an Excel spreadsheet on a NOMADS panel
« on: June 04, 2021, 07:55:23 PM »
Hi All,

I'm trying to display an Excel spreadsheet within a COM control defined on a NOMADS panel. I have the COM Control defined as "Excel.Application". In the "PostCreate" logic contains the following code:

filename$=pth("2013-09-30.xlsx")
com_1.ctl'Workbooks'Open(filename$)
com_1.ctl'Visible=1


When I test the panel, Excel starts in a window behind the NOMADS panel and loads the specified file. I've also tried something similar outside of NOMADS, with the same result; Excel opens in a separate window.

begin
def object xl,@(2,2,60,40)="Excel.Application"
xl'Workbooks'Open(pth("2013-09-30.xlsx"))
xl'Visible=1
xl'Quit()


I found some code in my Mailing List archive that works using "Shell.Explorer" and PDF files, and optimistically hoped it would work in a similar fashion with Excel.

Is it possible to do this? Any nudges in the right direction would be greatly appreciated!!

Regards,

Rob Leighton
Riverwood Enterprises Inc.

9
Language / Re: Directory +INFO
« on: April 08, 2021, 05:36:28 PM »
Hi James,

That can happen if the file is a copy of another file. The copy of the file gets a new 'creation date', but keeps the original 'last modified' date.  That's what happens on Windows, not sure if it's the same on Linux.

Hope that helps!

Rob Leighton
Riverwood Enterprises Inc.

10
Programming / Re: converting providex to pxplus - *viewer*
« on: April 06, 2021, 12:01:50 AM »
Hi,

There is an issue with your test program. You should be seeing an Error 20 Syntax error on the first line (CHN=HFN...). CHN is a System Variable and can't be used in this manner (Here's a link to the documentation https://manual.pvxplus.com/PXPLUS/variables/chn.htm)

Try changing your test program to:

CHAN=HFN; OPEN (CHAN)"*VIEWER*"
PRINT (CHAN)"TEST VIEWER"
CLOSE (CHAN)

I tried the above on a Win10/64 machine with a Demo version of PxPlus 17.10 (latest release) and the viewer opened as expected.

Regards,

Rob Leighton
Riverwood Enterprises Inc.


11
Programming / Re: CLEAR vs CLEAR Composite string
« on: February 14, 2021, 05:10:58 PM »
Hi Mike / JR,

I played around with this a bit this weekend.

Format 2 of the CLEAR directive works the same as Format 1 when you specify a list of variables.

It will:
- reset PRECISION to the default value specified by the 'PD' parameter (2 is the default).
- clear the FOR/GOSUB/WHILE stack.
- clear the DATA (not the ATTRIBUTES) from the variable DIMensioned as a composite string.

When I run the following program...

begin
!
precision 10
!
cust:iolist custnum$,custname$,balance
dim cust$:iol=cust
cust.custnum$="123",cust.custname$="ABC Supply",cust.balance=456.78
!
print "default PRC: ",prm('PD'),'LF'
!
for 1
print "Before CLEAR"
print "precision: ",prc
print "cust$....: ",lst(iol(cust$))," - ",sub(cust$,sep,"|")
!
clear cust$
!
print 'LF',"After CLEAR"
print "precision: ",prc
print "cust$....: ",lst(iol(cust$))," - ",sub(cust$,sep,"|")
!
next

... I get the following results:

->run
default PRC:  2

Before CLEAR
precision:  10
cust$....: iolist custnum$,custname$,balance - 123|ABC Supply|456.78|

After CLEAR
precision:  2
cust$....: iolist custnum$,custname$,balance - ||0|
next
Error #28: No corresponding FOR for NEXT
Current program is D:\PxPlus\Projects\Default\rob1, line 24

I ran this test on PxPlus 2020 Ver 17.10 on Windows and PxPlus 2016 Ver 13.00 with the same result.

If you change 'cust$' to 'cust.custname$', only that field is cleared.

I think the docs are wrong. The DIM directive (Format 2 - Define Composite String) documentation states that "You can use the CLEAR directive to reset a variable that is defined as a string template". What is meant by 'reset' may be debatable, but the attributes are definitely not being cleared as stated on the CLEAR directive page.

I don't use the CLEAR directive (at least, not that I can remember). To clear the data from a composite string I use 'cust$=""', and to clear the attributes I use 'DIM cust$(0)'.

Also, something else to note: when using CLEAR, don't forget that CLEAR also affects REPEAT..UNTIL/SWITCH..END SWITCH/WITH..END WITH. I think that's the complete list...

Regards,

Rob Leighton

12
Language / Re: password protected data files
« on: October 12, 2020, 04:26:16 PM »
Hi Paula,

You could try opening the files with a dummy (or null) password and then process the returned error code. Here's an example;

begin
!
! create a file with no password
erase "FileNoPass",err=*next
keyed "FileNoPass",[1:1:10],0,0
!
open (1)"FileNoPass"
write (1)"test","some data"
close (1)
!
! create a file with a password
erase "FileWithPass",err=*next
keyed "FileWithPass",[1:1:10],0,0
!
open lock (1)"FileWithPass"
password (1)"secret" required for open and on data
write (1)"test","some data"
close (1)
!
! process list of files
for filename$ from "FileNoPass,FileWithPass,MissingFile,"
!
print "processing filename: ",filename$
!
filechan=unt; open input (filechan,key="",err=*next)filename$
if tcb(2) then if err=12 then print "   *** file ",filename$," is missing."
!
close (filechan)
!
next

Regards,

Rob Leighton

13
Programming / Re: Binary auto increment key
« on: October 09, 2020, 07:22:27 PM »
Hi Peter,

That's an interesting idea, but I think it has to do with type of auto-increment field being used. I tried creating a blank-filled and zero-filled auto-increment and those 2 types allowed the field to be initialized to either "" (null), " " (blank) or $00$. In all 3 cases the fields are part of an internal key.

Regards,

Rob


14
Programming / Re: Binary auto increment key
« on: October 09, 2020, 12:27:40 PM »
Hi Michael,

I'm no auto-increment key expert, but here's an example that seems to work correctly.

begin
!
! define the file
erase "testfile",err=*next
keyed "testfile",[0:1:4:"I"],0,-1000
!
testfile=unt; open (testfile,rec=testfile$,iol=testfile)"testfile"
testfile:iolist id$:[chr(4)],cust_num$,cust_name$
!
! write some data records
for recnum=1 to 5
testfile.id$=dim(4,$00$)
testfile.cust_num$=str(recnum:"000000")
testfile.cust_name$="Customer "+testfile.cust_num$
write (testfile)
next
!
! display records in file
select *,rec=testfile$ from testfile begin ""
print hta(kec(testfile))," - ",testfile.cust_num$," - ",testfile.cust_name$
input *; if ctl=4 then escape
next record

In Gords' post, he indicated that the variable containing the auto-increment must be blank, but I could only get it to work by filling it with $00$'s.

Hope this helps (and is correct!!)

Regards,

Rob Leighton

15
Programming / Re: Getting Text of a Program Line Number
« on: June 01, 2020, 12:37:04 PM »
Hi Jeffrey,

Take a look at the utility program "*pg.cnv". It can be used to convert a program file to a text file (and vice versa).

Regards,

Rob Leighton

Pages: [1] 2