Recent

Author Topic: Just some Listbox Stuff to Learn From  (Read 786 times)

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Just some Listbox Stuff to Learn From
« on: January 19, 2023, 05:39:48 pm »
Was practicing Listbox functionality and decided to share what I came up with.



Type in some stuff into the Input Tedit box and click Add. Then click on each of the left buttons working your way down.

Enjoy and learn, as I did.

« Last Edit: January 20, 2023, 05:00:24 am by Boleeman »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Just some Listbox Stuff to Learn From
« Reply #1 on: January 19, 2023, 07:49:56 pm »
Yes, TStrings abstraction at work! :)
Oh, when examining the code: no need to move, just assign... figure that out.
All controls you use have a property Items or Strings which are declared as TStrings. All of them can use the same TStrings....
« Last Edit: January 19, 2023, 08:43:27 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Just some Listbox Stuff to Learn From
« Reply #2 on: January 19, 2023, 10:38:31 pm »
Thaddy, thanks for the advice.

What I did notice was that the mouse cursor became sluggish when I tried to move and position the controls. Cursor actually got stuck and then somehow some type of auto captioning was taking place (variables were being named label1). Also did not realize that there was a separate checkedlistbox (Vb6 only has one).

Still need to also work out:

Focus on Tedit after inputting to listbox
Moving multiple listbox items up and down
Moving to top and bottom of list
Randomizing items
Colouring of listbox items (text color and back cell color)
Screenshoting particular components and hiding others.
Columns in listbox.

Still lots to learn, but finally getting the hang of it.

Lastly, I have had problems with the form not opening up after double clicking the project file (so I need to Open the pas file manually every so often to get the form view back again). Not sure why this is happening? Sometimes, I also get another form from a different project loading. A bit frustrating. I tried to install Lazarus 64 bit with 32 bit addon but found I was getting corrupted data, so I wiped that and just installed the 32bit compiler.  I do a CloseAll and the New App, but still get those problems. Perhaps it is the config file? (although I went to my profile and deleted those as well). Feeling like I'm going round in circles to fix this problem. I'm running AMD A9 CPU. Any thoughts or advice would be appreciated to try to fix this form loading problem.
« Last Edit: January 19, 2023, 11:03:41 pm by Boleeman »

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Just some Listbox Stuff to Learn From
« Reply #3 on: January 19, 2023, 11:40:11 pm »
if you are in the IDE with a project loaded and you don't see any forms pertaining to that project showing, then go to the PROJECT:FORMS:  mennu,and pick from the list of forms in the project and double click there.

 There are other ways to, but this seems to work.
The only true wisdom is knowing you know nothing

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2068
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Just some Listbox Stuff to Learn From
« Reply #4 on: January 19, 2023, 11:52:11 pm »
Still have to work out how to set focus on the input edit box after clicking Add.
I did not watched your source so I do not know your names, forgive me.
Anyway, this is how you do it:
Code: Pascal  [Select][+][-]
  1. procedure AddClick(SomeImportant: Types);
  2. begin
  3.   // do your add stuff
  4.   Edit1.SetFocus;
  5. end;

I guess you find out how I do mean it.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Just some Listbox Stuff to Learn From
« Reply #5 on: January 20, 2023, 01:12:09 am »
Thanks jamie and KodeZwerg.

KodeZwerg I saw you were on but probably busy. Not a problem. You have helped me a a lot.

With the focus of Tedit:

I had   "Edit1.Focused; "  instead of    Edit1.SetFocus;       Ah so close!








Jamie been doing "pick from the list of forms in the project and double click there."

Still getting that Window problem. Read something about having two ppu ? Not sure if that is the problem. Frustrating.

But there must be a reason why it is happening. Read over threads for possible solutions. To me it sort of looks like the location of the form in the project file is being lost in the IDE but not compiler.
When I first installed the 64Bit Lazarus and then the 32BitAddon thats when it complained about duplicate config files". Also after doing Online Package Manager of BGRA BMP and Controls problem seems to happen more. Screenshot shows missing Form.
Strange thing is when I compile with missing Form it still works, but I cannot view the code/Form until I open it again. Laz. Compiler knows where it is but the Laz. IDE does not. Seen other posts with similar problems so hopefully someone may know the solution. Downloaded my Lazarus from SourceForge. Maybe there is another source, not sure?

 If problems persist "See your (Lazarus) Doctor". HaHa. Just joking.







« Last Edit: January 20, 2023, 01:24:56 am by Boleeman »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2068
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Just some Listbox Stuff to Learn From
« Reply #6 on: January 20, 2023, 01:24:01 am »
@Booleman, can you update your attached image, it is hard to see anything on it beside a big white nothing and pieces of ... lazarus?
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Just some Listbox Stuff to Learn From
« Reply #7 on: January 20, 2023, 01:26:51 am »
Sorry KodeZwerg I went to change the size but the picture got lost from clipboard before I could resize it again.

Been trying to reproduce the problem, but Murphy's Law strikes again. Forms loading.

Yesterday forms were not loading about ten times. Today twice. When it happens again I will do another screenshot.
« Last Edit: January 20, 2023, 01:33:49 am by Boleeman »

Boleeman

  • Sr. Member
  • ****
  • Posts: 433
Re: Just some Listbox Stuff to Learn From
« Reply #8 on: January 20, 2023, 02:00:22 am »
Here we go KodeZwerg.

Opened up the SuperFormula ListView Version and Form disappeared again.

Could it be due to that BGRA problem mentioned about point arrays making BGRA unstable. I installed the BGRABitmap and controls from the OPM (maybe that's what's causing the unstableness. Also noticed yesterday mouse had problems in Laz when moving and sizing controls. It was seizing up as well. Windows did an update yesterday as well.

Screenshot nice and big this time.

and Object Inspector screenshot.



« Last Edit: January 20, 2023, 02:05:11 am by Boleeman »

 

TinyPortal © 2005-2018