Click Here
home features news forums classifieds faqs links search
5687 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
Home
Features
News
Forums
Classifieds
Links
Downloads
Extras
OS4 Zone
IRC Network
AmigaWorld Radio
Newsfeed
Top Members
Amiga Dealers
Information
About Us
FAQs
Advertise
Polls
Terms of Service
Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
17 crawler(s) on-line.
 11 guest(s) on-line.
 1 member(s) on-line.


 Fl@sh

You are an anonymous user.
Register Now!
 Fl@sh:  56 secs ago
 amisteph:  5 mins ago
 Derfs:  15 mins ago
 vox:  17 mins ago
 Rob:  19 mins ago
 Kronos:  34 mins ago
 g0blin:  41 mins ago
 emeck:  47 mins ago
 Futaura:  47 mins ago
 lionstorm:  48 mins ago

/  Forum Index
   /  Amiga OS4 Software
      /  SOLVED ... Thanks broadblues for your help
Register To Post

PosterThread
redfox 
SOLVED ... Thanks broadblues for your help
Posted on 22-Sep-2019 23:09:25
#1 ]
Super Member
Joined: 7-Mar-2003
Posts: 1696
From: Canada

I am trying to display a text file in a window using ProAction and TextEditor gadget.

My questions?
Does the TextEditor text import function have a default limit of approx 256 characters?
If so, how do I increase this limit to say 1000 characters?

I use ARexx to open the text file, read characters into a text string and pass the text string over to the texteditor using GA_TEXTEDITOR_Contents set to text.string.

If it is a small text file (say 100 charcters), no problem. All charcters are displayed.

If the text file has more than approx 256 characters, nothing is displayed in the window.

But, I have confirmed that all the characters appear in the text string, by using the ARexx "say" command to print the text string in a console window.

Any help would be greatly appreciated.

redfox


P.S. My goal is to simply use a window to display a text file. If there is another way to do this without the text editor gadget, I would also like to know. I use ARexx as my programming language. My original program used a "console" window to display the text file. I also have other versions of my program which use RxMUI to display text files in nice MUI windows, with menus, buttons and texteditor or listview.

Last edited by redfox on 09-Oct-2019 at 07:38 PM.
Last edited by redfox on 09-Oct-2019 at 07:30 PM.
Last edited by redfox on 04-Oct-2019 at 08:27 PM.
Last edited by redfox on 04-Oct-2019 at 08:20 PM.
Last edited by redfox on 22-Sep-2019 at 11:35 PM.
Last edited by redfox on 22-Sep-2019 at 11:31 PM.

 Status: Offline
Profile     Report this post  
redfox 
UNSOLVED .. Project abandoned
Posted on 4-Oct-2019 20:19:15
#2 ]
Super Member
Joined: 7-Mar-2003
Posts: 1696
From: Canada

I have decided to abandon this project and move on.

I was simply attemting to display a text file in a Reaction window using ProAction to help me build the GUI. I read the text file into a text string, open the window and display the text.

Reaction texteditor gadget works fine for very small text files of less than 256 characters.
If the file is more than 256 characters, no text is displayed in the window.

I also tried using label.image to display the text. Same results.

No issues if I use a console window to display the text, but that defeats my purpose of using Reaction windows.




Please note, I do not have these issues with the MUI texteditor class, or MicroRexx, or RexxBGUI, although, to be fair, MicroRexx and RexxBGUI do not use a text editor function.

I am very happy with the MUI version of this same program which I built and tweeked during April and May.

---
redfox

Last edited by redfox on 04-Oct-2019 at 08:31 PM.
Last edited by redfox on 04-Oct-2019 at 08:30 PM.

 Status: Offline
Profile     Report this post  
tonyw 
Re: UNSOLVED .. Project abandoned
Posted on 4-Oct-2019 22:21:42
#3 ]
Elite Member
Joined: 8-Mar-2003
Posts: 3168
From: Sydney (of course)

@redfox

Why are you trying to read the whole display in a single read operation?
Why not read it line by line, then any 256-char limit will be more than sufficient.

If you try to read it in a single Read, then you will always run into a buffer limit of some kind. I don't know where the limit is in this case (could be ARexx).

_________________
cheers
tony

Hyperion Support Forum: http://forum.hyperion-entertainment.biz/index.php

 Status: Offline
Profile     Report this post  
redfox 
Re: UNSOLVED .. Project abandoned
Posted on 5-Oct-2019 1:51:18
#4 ]
Super Member
Joined: 7-Mar-2003
Posts: 1696
From: Canada

@tonyw

Quote:
Why not read it line by line, then any 256-char limit will be more than sufficient.


This is exactly what I want to do. I want to read the text file line by line.
- read a line from the text file ... write it to the display window.
- repeat until EOF

Unfortunately, I haven't figured out how to do this with a Reaction window using ARexx and ProAction.


Already working fine on several other versions of my program.

Using console window to display text file ...
- read a line from the text file ... write it to the console
- repeat until EOF

Using MicroRexx window to display text file ...
- read a line from the text file ... NPRINT to the window
- repeat until EOF

Using rexxbgui.library to display text file in a listview ...
- read a line from the text file ... call bguilistvaddentry to add the line to the listview
- repeat until EOF

Using rxMUI to display a text file in a MUI listview ...
- read a line from the text file ... call DoMethod to insert the line at the bottom of the listview
- repeat until EOF

Using rxMUI to display a text file with MUI TextEditor class was actually the easiest ...
- call DoMethod to open the text file

call DoMethod("te","open","ram:textfile")

---
redfox

Last edited by redfox on 05-Oct-2019 at 01:53 AM.

 Status: Offline
Profile     Report this post  
Minuous 
Re: UNSOLVED .. Project abandoned
Posted on 5-Oct-2019 6:35:09
#5 ]
Regular Member
Joined: 30-Oct-2004
Posts: 317
From: Unknown

@redfox

It works fine in AmiArcadia, Report+, etc. so it's not a limitation of ReAction, and there is no need to do things 256 bytes at a time. Maybe a ProAction-specific issue? You could email its programmer about it if he doesn't see this thread.

Last edited by Minuous on 05-Oct-2019 at 07:13 AM.
Last edited by Minuous on 05-Oct-2019 at 06:36 AM.

 Status: Offline
Profile     Report this post  
broadblues 
Re: UNSOLVED .. Project abandoned
Posted on 5-Oct-2019 14:00:43
#6 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4398
From: Portsmouth England

@Minuous

Quote:

Maybe a ProAction-specific issue?


I have a hunch it may be an issue with reading the stem variables in. The RexxSysLib API for this uses 256 buffers IRRC

@redfox

Could you post the full code so that I can debug the issue? or email it to andy@broad.ology.org.uk if you don't want to post it here?






_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
redfox 
Re: UNSOLVED .. Project abandoned
Posted on 5-Oct-2019 23:29:57
#7 ]
Super Member
Joined: 7-Mar-2003
Posts: 1696
From: Canada

@broadblues

Thanks so much for offering to look into this for me.

I sent you an email to andy@broad.ology.org.uk

with 3 attachments (the program, a text file that displays ok and a text file that does not display in the window (too many characters?)).


Thanks,
redfox

 Status: Offline
Profile     Report this post  
broadblues 
Re: UNSOLVED .. Project abandoned
Posted on 8-Oct-2019 12:42:19
#8 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4398
From: Portsmouth England

@redfox

As I suspected due to the way GetRexxVarFromMsg() works the stem var values are limited to 256 bytes in length. Added to that my stem var code will set any truncated value to "" so you don't just see the fist 255 characters if it goes over the limit.


As an alternative you can use TAGSTRING there is no size limit here. But you can't have any commas in the passed string as that is the TAGSTRING delimeter. I don't have a machanism for escaping any commas in string data as yet. I could add that.

I do have an internal string object type which I could expose in the API much like the screen object is so you could pass a TT_ID "@stringid" instead of a TT_STRING, might still need to implment comma escapeing for that too though but you could use TAGSTEM then.

I will make the changes in the next few dayus and send a stest version with some example code for you to try.

THis issue has never cropped up for me as I'm always working with short strings for SketchBlock graphics.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Deniil715 
Re: UNSOLVED .. Project abandoned ... see my 2nd post
Posted on 8-Oct-2019 14:58:35
#9 ]
Elite Member
Joined: 14-May-2003
Posts: 4181
From: Sweden

@redfox

Crazy idea: Could it be that the last line is empty, and by using GA_TEXTEDITOR_Contents you *set* the text, not *add*, and so the last line you set is empty so the whole texteditor becomes blank?

_________________
- Don't get fooled by my avatar, I'm not like that (anymore, mostly... maybe only sometimes)
> Amiga Classic and OS4 developer for OnyxSoft.

 Status: Offline
Profile     Report this post  
salass00 
Re: UNSOLVED .. Project abandoned ... see my 2nd post
Posted on 8-Oct-2019 15:55:40
#10 ]
Elite Member
Joined: 31-Oct-2003
Posts: 2700
From: Finland

@Deniil715

If GA_TEXTEDITOR_Contents is used then that's probably what's happening.

To incrementally add text to the texteditor the GM_TEXTEDITOR_InsertText method has to be used.

This is what I use in AminetReadme to read and add text line by line:


while (stat = FGets(file, line, sizeof(line))) {
DoGadgetMethod((struct Gadget *)gui->gadgets[GID_MAIN_TEXTAREA],
win, NULL, GM_TEXTEDITOR_InsertText, NULL, line,
GV_TEXTEDITOR_InsertText_Bottom);
}


Not sure what the equivalent using ProAction would be...

 Status: Offline
Profile     Report this post  
broadblues 
Re: UNSOLVED .. Project abandoned ... see my 2nd post
Posted on 9-Oct-2019 11:55:12
#11 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4398
From: Portsmouth England

@salass00

Good idea that would work arround the tags length and comma issues, should have thought of that myself!

ProAction encapsulates that method with the following command

Quote:

TEXTEDITORINSERTTEXT

GUIID/K/N/A,TEDID/K/N/A,TEXT/K/A,POS/K/N

Insert text into the editor
GUIID/K/N/A
TEDID/K/N/A
TEXT/K/A
Text to insert
POS/K/N
Position to insert at 0 = top 1 = bottom 2 = at cursor.



I'll test and add some example code here a bit later.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
broadblues 
Re: UNSOLVED .. Project abandoned ... see my 2nd post
Posted on 9-Oct-2019 12:21:16
#12 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4398
From: Portsmouth England

@broadblues

OK here is a modified version of redfoxes test program using the inster text method, it clears the text editor to start this is not strictly neccessary for a one of case, but is what you would need if updating the window with different files later on....



/* text100

Usage: text100 <filename>

*/


/* get filename from command line */

parse arg filename


/* read text file and replace newlines with *N */

text.string = ""

if open('source',filename,READ) then do
line = readln('source')
do while ~eof('source')
text.string = text.string || line || "*N"
line = readln('source')
end
call close('source')
end

/* Libraries and ProAction */

options results


/* Make sure rexxsupport is available */

if ~show('L', "rexxsupport.library") then do
if ~addlib("rexxsupport.library", 0, -30, 0) then do
say "Cannot add rexxsupport.library!"
exit 10
end
end


/* Make sure ProAction is available */

if ~show('P', "PROACTION") then do
myCmd = "run NIL: *>NIL: APPDIR:ProAction"
address command myCmd
myCmd = "WaitForPort PROACTION"
address command myCmd
if RC >= 5 | ~show('P', "PROACTION") then do
say "Cannot start ProAction server!"
exit 10
end
end


/* Target the ProAction server as default from now on */

address PROACTION


/* Open our ARexx port for receiving messages from ProAction */

w2Portname = "TextReader" || pragma('I')

if ~openport(w2PortName) then do
say "Cannot open own message port!"
exit 10
end


/* Display window (used to display the text file) */

w2GuiTags.0 = 12
w2GuiTags.1.TAGNAME = "WA_Top"
w2GuiTags.1.TAGVALUE = 110
w2GuiTags.2.TAGNAME = "WA_Left"
w2GuiTags.2.TAGVALUE = 1
w2GuiTags.3.TAGNAME = "WA_Width"
w2GuiTags.3.TAGVALUE = 1000
w2GuiTags.4.TAGNAME = "WA_Height"
w2GuiTags.4.TAGVALUE = 300
w2GuiTags.5.TAGNAME = "WA_DragBar"
w2GuiTags.5.TAGVALUE = 1
w2GuiTags.6.TAGNAME = "WA_DepthGadget"
w2GuiTags.6.TAGVALUE = 1
w2GuiTags.7.TAGNAME = "WA_SizeGadget"
w2GuiTags.7.TAGVALUE = 1
w2GuiTags.8.TAGNAME = "WA_CloseGadget"
w2GuiTags.8.TAGVALUE = 1
w2GuiTags.9.TAGNAME = "WA_Activate"
w2GuiTags.9.TAGVALUE = 1
w2GuiTags.10.TAGNAME = "WA_Title"
w2GuiTags.10.TAGVALUE = "Textreader"
w2GuiTags.11.TAGNAME = "WA_PubScreenName"
w2GuiTags.11.TAGVALUE = "Workbench"
w2GuiTags.12.TAGNAME = "WA_PubScreenFallBack"
w2GuiTags.12.TAGVALUE = 1


/* TextEditor layout */

textEditor.0 = 1
textEditor.1.TAGNAME = "GA_TEXTEDITOR_FixedFont"
textEditor.1.TAGVALUE = 1

/* or */
textEditorTags = "GA_TEXTEDITOR_FixedFont,1,TAG_DONE"


/* Initialise a new GUI and pass back a "key" */

'CREATEGUI PORTNAME "' || w2PortName || '"TAGSTEM w2GuiTags'
if RC > 0 then do
say "Cannot create GUI!"
exit 10
end

w2GuiKey = RESULT


/* Build the GUI */

'ADDLAYOUT GUIID ' w2GuiKey ' TAGSTRING "LAYOUT_Orientation,LAYOUT_ORIENT_VERT,TAG_DONE"'

/* Add TextEditor */

'ADDGADGET GUIID ' w2GuiKey ' GADGETCLASS "texteditor.gadget" TAGSTRING "' || textEditorTags || '"'

text.GID = RESULT

'CLEARTEXTEDITOR GUIID ' w2GuiKey ' TEDID ' text.GID
'TEXTEDITORINSERTTEXT GUIID ' w2GuiKey ' TEDID ' text.GID ' TEXT "' || EscapeQuotes(text.string) || '" POS 2'

'ENDLAYOUT GUIID ' || w2GuiKey

'OPENGUIWINDOW GUIID ' || w2GuiKey



/* wait for user */

WaitForUser:
do events = 1
gotMsg = waitpkt(w2PortName)
if gotMsg then do
pkt = getpkt(w2PortName)
do while pkt ~= '0000 0000'x
cmd = getarg(pkt)
call reply(pkt)
if cmd = "QUIT" then leave events
parse var cmd event " GUIID" sentGuiKey .
select
when event = "CLOSE" then leave events
when event = "GADGETUP" then do
parse var cmd junk "GADGETID " gadID ' CODE ' eventCode .
select
when gadID = MQUIT then leave events
when gadID = MLIST then call listmail
when gadID = MPREV then call previous
when gadID = MNEXT then call next
when gadID = MREPLY then call replymail
when gadID = MFORWARD then call forwardmail
when gadID = MDELETE then call deletemail
when gadID = MSAVE then call savemail
when gadID = MPRINT then call printmail
when gadID = MCOMPOSE then call sendmail
otherwise nop
end
end
otherwise nop
end
pkt = getpkt(w2PortName)
end
end
end


/* Clean up and leave the program. */

cleanup:
'CLOSEGUIWINDOW GUIID ' || w2GuiKey
'DESTROYGUI GUIID ' || w2GuiKey

if debug2 = 1 then say "closing program"

exit 0


EscapeQuotes:
procedure

parse arg string

out = ""

do while pos('"',string) > 0
out = out || left(string, pos('"',string) - 1) || '*"'
string = right(string,length(string) - pos('"',string))
end

out = out || string
return out

Last edited by broadblues on 09-Oct-2019 at 12:23 PM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
redfox 
SOLVED ... Thanks broadblues for your help
Posted on 9-Oct-2019 19:36:34
#13 ]
Super Member
Joined: 7-Mar-2003
Posts: 1696
From: Canada

@broadblues
@all

Thanks so much Andy and all who replied. I appreciate all your efforts to help me.

Works perfectly now.

---
redfox

Last edited by redfox on 09-Oct-2019 at 11:52 PM.

 Status: Offline
Profile     Report this post  

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle