Displaying TXT-file in the file after the upgrade file

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Displaying TXT-file in the file after the upgrade file

#1 Post by Eugene Lutsenko »

Hello, Roger!

I'm doing an interesting mode to solve the assignment problem (knapsack). In the upper left window of the specified resource in the classes - destination options. In the upper right window, set the cost of the appointment of various objects in these classes. And in the bottom window, I want to bring the results of the destination. These results are stored in a text file in the application folder. In general, the results obtained to withdraw, but only those that were to run mode. And I would like to be updated when a file is updated with the results after clicking "Assign objects to classes." By pressing this button displays a text file is generated. If you just need to display a variable in a row I could:

Code: Select all

@ 0,0 DCSAY {|| MessIPC } OBJECT oSay1 SAYSIZE 133 FONT "9.HelvBold"
A file in the window does not work. Maybe help me? I'm sure for you, nothing is impossible. To display the file in the window I use your function: DCMULTILINE:

Code: Select all

@1, 2 DCMULTILINE nResNaz PARENT oGroup3 SIZE 2*WW,HW-4 FONT "10.Courier New" EDITPROTECT {||.T.}
Here, the variable has a value nResNaz file to display:

Code: Select all

nResNaz = FileStr(mFileName)
Image
My original text in the unlikely event of interest. Of course I can bring him. But perhaps more important is the principle that allows you to do this. If it is easier to do than with txt-, on a pdf-file, you can first convert txt => pdf.
PS
A print that file I have learned in the subject: http://bb.donnay-software.com/donnay/vi ... 5&start=10

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#2 Post by rdonnay »

Your question is confusing.

If your file is simply a text file, then using DCMULTILINE is the correct way to do this.

If your file is a PDF or HTML or DOC, then the Universal web browser is the best way to do this.

You would use DCHTMLVIEWER instead of DCMULTILINE and then use oWebBrowser:navigate( cFileName ) to display the document.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#3 Post by Eugene Lutsenko »

I just wanted this image in the bottom window to renew itself as the txt-file changes after processing.
What is the easiest program to convert txt to pdf or html?
Last edited by Eugene Lutsenko on Mon Apr 20, 2015 9:06 am, edited 1 time in total.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#4 Post by rdonnay »

I just wanted this image in the bottom window to renew itself as the txt-file changes after processing
This would be done by running another thread that is constantly monitoring the text file date/time.

Code: Select all

@1, 2 DCMULTILINE cResNaz PARENT oGroup3 SIZE 2*WW,HW-4 FONT "10.Courier New" EDITPROTECT {||.T.} OBJECT oResNaz

DCREAD GUI .. EVAL {|o|o := Thread():new(),Sleep(5),o:start({||MonitorTextFile(@cResNaz,oResNaz)})}


STATIC FUNCTION MonitorTexFile( cRezNaz, oResNaz )

LOCAL aDir := Directory('textfile.txt')
LOCAL cTime := aDir[1,4]

DO WHILE .t.

  Sleep(100)

  aDir := Directory("textfile.txt")
  IF cTime # aDir[1,4]
    cRezNaz := MemoRead("textfile.txt")
    oResNaz:setData()
    cTime := aDir[i,4]
  ENDIF
  
ENDDO

RETURN nil
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#5 Post by Eugene Lutsenko »

Tried c:\exp19\Samples\Activex\webbrowser.prg with txt-file. Everything works fine. But a lot of excess: the address of the access key, the status bar. Is there not as simple forms of treatment to DCHTMLVIEWER. Something like this:

Code: Select all

@1, 2 DCHTMLVIEWER oWebBrowser NAVIGATE cNavigate SIZE 2*WW,HW-4 FONT "10.Courier New" PARENT oGroup3
Will the picture change when changing the displayed file? Follow the change in the date and time the file was created is not quite right for two reasons. Firstly I know it changed since he change it by pressing. Second, it slows down viewing.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#6 Post by rdonnay »

Did you try my 2nd suggestion?
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#7 Post by Eugene Lutsenko »

rdonnay wrote:Did you try my 2nd suggestion?
Tried. But the sense of DCHTMLVIEWER more appropriate. Only need to do first digging GO formation txt-file, and then it display the files. But it is necessary to display it in the group PARENT, rather than in a separate window

Image

Code: Select all

FUNCTION Main()

LOCAL GetList[0], oWebBrowser, oToolBar, GetOptions, oStatus, ;
      cNavigate := Pad('C:\1\Res_naz.txt',100)

N = 1


@ 0,0 DCGET cNavigate GETSIZE 400 PIXEL RESIZE DCGUI_RESIZE_REPOSONLY_Y ;
      KEYBLOCK {|n,x,o|IIF(n==xbeK_ENTER,(o:getData(), ;
                       oWebBrowser:navigate(cNavigate)),nil)}

@ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Go' ;
   SIZE 30, 20 PIXEL ACTION {||oWebBrowser:LC_navigate(Alltrim(cNavigate))} ;
   RESIZE DCGUI_RESIZE_REPOSONLY_Y

@  30,0 DCHTMLVIEWER oWebBrowser SIZE 440,400 PIXEL ;
        NAVIGATE cNavigate ;
        STATUSTEXTCHANGE {|c|oStatus:setCaption(c)} ;
        RESIZE DCGUI_RESIZE_RESIZEONLY

@ 440,0 DCSAY '' OBJECT oStatus ;
        SIZE 440,20 COLOR GRA_CLR_BLUE, GRA_CLR_WHITE ;
        SAYLEFTCENTER ;
        RESIZE DCGUI_RESIZE_RESIZEONLY_X

@ 465,0 DCTOOLBAR oToolBar SIZE 400,20 PIXEL ;
        BUTTONSIZE 60,20

DCADDBUTTON CAPTION 'Forward' ACTION {||oWebBrowser:forward()} ;
   PARENT oToolBar

DCADDBUTTON CAPTION 'Back' ACTION {||oWebBrowser:back()} ;
   PARENT oToolBar

DCADDBUTTON CAPTION 'Home' ACTION {||oWebBrowser:home()} ;
   PARENT oToolBar

DCADDBUTTON CAPTION 'Stop' ACTION {||oWebBrowser:stop()} ;
   PARENT oToolBar

DCGETOPTIONS ;
   PIXEL ;
   RESIZE

DCREAD GUI ;
   FIT ;
   OPTIONS GetOptions ;
   TITLE 'Welcome to our Website'

RETURN nil

* --------------

FUNCTION LC_navigate(cNavigate)

String = REPLICATE("*", ++N)
StrFile(String, cNavigate)          // Запись текстового файла "Inp_name.txt"

RETURN nil
[/size]

Only need by pressing GO close the file (it is advisable to continue his show), and then modify it, and then again open for viewing.

Is there no possibility for the command:

Code: Select all

@1, 2 DCMULTILINE cRezNaz PARENT oGroup3 SIZE 2*WW,HW-4 FONT "10.Courier New" EDITPROTECT {||.T.} OBJECT oResNaz
use the design of the form:

Code: Select all

@1, 2 DCSAY {|| cRezNaz } PARENT oGroup3 OBJECT oResNaz SAYSIZE 2*WW FONT "9.HelvBold" 
To get something like:

Code: Select all

@1, 2 DCMULTILINE {|| cRezNaz } PARENT oGroup3 SIZE 2*WW,HW-4 FONT "10.Courier New" EDITPROTECT {||.T.} OBJECT oResNaz
Then everything would be just.

Maybe try to place the text in the MEMO field records? Mapping database is refresh accurately without problems.

Code: Select all

DC_GuiMemoEdit( Address->Memo, 5, 10, 20, 60, .F., .F.)

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#8 Post by Eugene Lutsenko »

With a database update for changes in the content comes clean. But I can not display the memo-field in the right way in the window, where there are two windows (as shown above). Is it possible to display the database without separator lines (lines that look like continuous text)?

And you can browse memo-field database is not using MEMOEDIT(), and with the DCBROWSECOL...?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#9 Post by rdonnay »

But I can not display the memo-field in the right way in the window, where there are two windows (as shown above).
Why would you want to display a text file in 2 windows?

You may be able to display a browse without the lines.
You will need to look at "Presentation Parameters"/
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Displaying TXT-file in the file after the upgrade file

#10 Post by Eugene Lutsenko »

I got almost all the most stupid way: by making use of the database (without memo-fields). Showing modified by calculating the database beautifully updated. But there are some decoration things that I do not know how to do. I do not know how to remove the seperator between the lines or make it invisible. I do not know how to display the names of the database without speakers.
Image
I can not really express the idea because of ignorance of the English language. Please forgive me.

Post Reply