Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Append?

JoseCJoseC Member Posts: 17
When you open a textfile with append it is set to the end of the file, is there a way to put it anywhere in the file? And I must use a textfile.

Also, is there a way to pop up a message dialog even if the program ain't active? My dialogs just pops up in the background and I must click on my main program to see them.

Thanx

Comments

  • zibadianzibadian Member Posts: 6,349
    : When you open a textfile with append it is set to the end of the file, is there a way to put it anywhere in the file? And I must use a textfile.
    :
    : Also, is there a way to pop up a message dialog even if the program ain't active? My dialogs just pops up in the background and I must click on my main program to see them.
    :
    : Thanx
    :
    It is not directly possible to insert lines into a textfile, but there are two ways to work around it.
    1: Load the textfile in a TStringList object; then add the lines to it and finally save it again under the same name.
    2: Copy the file into a second file line for line. Once you reach the spot, where you want to insert the new lines, write that line. Then resume copying.
    The first method is preferred, because it is safer and quicker.

    As for the second question, the best way I can come up with right now, it to set the FormStyle to fsStayOnTop. That should show the dialog. You might also find another solution in the help files, when looking at the focus-related methods.
Sign In or Register to comment.