Jump to content

stephanos

Members
  • Content Count

    9
  • Joined

  • Last visited

Posts posted by stephanos


  1. Thanks to all

     

    I will register with Lazarus

     

    Meanwhile, much information to absorb, and  I will try to do so.  I now have a way forward with TStaticText.

     

    There are many books to choose from as well.  Does anyone have a recommendation for an Object newbie.  Not new to command line.  Have coded in C and Pascal, JavaScript

     

    Thanks again


  2. Dear All

     

    I am being driven mad by the fact that some objects do not do things. I started with buttons and abandoned them as I could not control the colour of the caption. I went onto BitBtn’s only to find that & next to a character in the caption does not display the letter as underlined at run time and sometimes does display the letter as underlined at run time after ALT and the accelerated Char are pressed. I should also say that double &, &&Save, as a caption simply displays as “&Save” with nothing underlined.

         I read around and discovered that labels, and I have many of those on my form, allows the display of the letter as underlined at run time and are even visible at design time. Good old labels. For this to happen I just need to ensure the property “ShowAccelChar” is enabled. I can do that!  So I did an experiment with another label and guess what? Use of ActiveControl to place the focus on a label object does not work.

         Form1.ActiveControl := Label11; // does not work

    The error message says: ‘simpleformsunit.pas(181,45) Error: Incompatible type for arg no. 1: Got "TLabel", expected "TwinControl" ’

    It did work with BitBtn: Form1.ActiveControl := BitBtn3; // Open File has focus

     

    Naturally, I have googled this issue but there is nothing specific about ActiveControl and the label object. As there are many many objects in the IDE I am hoping to draw upon someone’s knowledge to find out if I can do what I want, a via which object.  Perhaps the error message is helpful to someone?  Is there an object that I can use as a button (onclick) that will allow me to:

    1. allow use of ActiveControl
    2. set the tab order
    3. offer a tag for use as an integer variable at run time
    4. allow me to control the colour of the caption and the font size (not at run time)
    5. allow to to position the caption centre vertically and horizontally (not at run time)
    6. enable and un-enable at run time
    7. allow accelerated chars to be visible at run time
    8. have an onclick Event

     

    Thanks, wait to hear

     

    Windows 10, 64 bit

    Free Pascal Lazarus Project, version2.0.6


  3. Dear All

     

    I am being driven mad by the fact that some objects do not do things. I started with buttons and abandoned them as I could not control the colour of the caption. I went onto BitBtn’s only to find that & next to a character in the caption does not display the letter as underlined at run time and sometimes does display the letter as underlined at run time after ALT and the accelerated Char are pressed. I should also say that double &, &&Save, as a caption simply displays as “&Save” with nothing underlined.

     

    I read around and discovered that labels, and I have many of those on my form, allows the display of the letter as underlined at run time and are even visible at design time. Good old labels. For this to happen I just need to ensure the property “ShowAccelChar” is enabled. I can do that!

     

    So I did an experiment with another label and guess what? Yes you are right, I cannot vertically centre the caption of a label. I can of course with Button and BitBtn.

     

    Before I go into a complete circle of idiocy, can I ask if there is an object that I can use as a button (onclick) that will allow me to:

    a) set the tab order

    b) offer a tag for use as an integer variable at run time

    c) allow me to control the colour of the caption and the font size (not at run time)

    d) allow to to position the caption centre vertically and horizontally (not at run time)

    e) enable and un-enable at run time

     

    Thanks, wait to hear

     

    Windows 10, 64 bit

    Free Pascal Lazarus Project, version2.0.6


  4. I have written a simple file input programme in Lazarus to help me write an mp3 playlist. I have attached a screen shot. I have ensured the tab order works and it is as follows:

    Test File, Open File, Play List Window, Enter the Artist, Enter the Album, Enter the Complete File Name, Append, Save, Exit.

     

    I do not need a drop-down lists, such as File, Edit etc, but I am attracted to the idea that these BitBtn labels are a sort of tool bar, in text form only – no images, that the user can select, so that there is an alternative to Tab as a way to navigate around, if the mouse fails.

     

    Something like Labels at the top, with one letter underlined, T for Test File, that will become the focus when ALT and T are pressed, and that when selected will allow left and right keys to move between all of these Labels. And of course when selected pressing Enter will run them.

     

    I have looked at the objects available but it is not clear how to do this and indeed if it is possible at all.

     

    I suppose I want a drop-down with no additional menu options, a sort of menu of no options.

     

    Thanks in advance

    ScreenShot1.jpg


  5. Dear All

    Thanks. Resolved with this:

    while not Eof(myFile) do // read the file contents line by line
    
    begin
    
    ReadLn(myFile, lineoftext); // read in a line into a string
    
    filecontents.Add(lineoftext); // add occurrence to filecontents a TStringList
    
    end; // when all the lines are read from and into filecontents
    
    Memo1.Lines := filecontents; // write filecontents to the Memo window

     

    I will experiment with LoadFromFile as this appears to be more direct and look at INI as well.


  6. Dear All

     

    25 years ago I wrote a small database in Pascal for my A Level. 1 day ago I installed Lazarus as I want to code a Delphi Object Pascal project to write .m3u (Playlist) as plain text files, so as to save me manually writing playlist for my mp3 player. Each line is going to be an absolute path to a file that is on the mp3 player. Something like this:

    \Music\Akmed's Camel\Akmed's Camel\The Boston Flyer.mp3

    Granted this is nearly a pointless exercise. I chose it as a starting piece to learn Delphi object programming.

     

    I have a simple text file with two lines of text and a third line that is blank. The content was generated by two WriteLn() statements and then the file was closed.

    Here is the content of the experimental m3u file so far:

    Hello World

    more text

    blank line

     

    Next I want to press a button that opens the file and reads in each line and either per line writes the line to a Tmemo object, Memo1.Text := ???? or reads in each line to a string and then pastes the string into Memo1.Text := ????. I want the content to be reproduced over 2 lines. In theory I will then remove items I do not want and paste in items I do want.

     

    Here is my attempt so far:

    procedure TForm1.Button4Click(Sender: TObject);
    
    begin
    
    AssignFile(myFile, 'Test.txt');
    
    Reset(myFile);
    
    while not Eof(myFile) do
    
    begin
    
    ReadLn(myFile, lineoftext);
    
    Memo1.Text := lineoftext;
    
    //finaltext := finaltext;
    
    end;
    
    CloseFile(myFile); // Close the file
    
    end;

     

    Here is the content of Memo1.Text after clicking the button:

    more text

     

    I have lost the first line and nearly the will to live. I understand that readLn excludes a the newline instruction. That is half my problem. The other half is how to handle the content of each iteration of readLn. The remaining half is how to send the content Memo1. A problem of three halves you might say.

     

    Windows 10, 64 bit

    Free Pascal Lazarus Project, version2.0.6

×