Jump to content

Search the Community

Showing results for tags 'listbox'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 3 results

  1. Something curious is occurring in one of my VCL projects: The application works perfectly, and has several buttons, list boxes and one datagrid. The TOP property of only 1 button, the HEIGHT property of the Listobx and the TOP property of the datagrid change back to a fixed value when the form is closed. For example the button in question upon opening after a close unit, is off the form. (top value greater than form height). I move the button so it is visible again on the form. Close form. Open form - button TOP is back to the other value, 'out of sight'. Short solution is to redefine the respective property in the on form create event....? Not a real solution. Is this a DFM issue? This is a new application, other apps - seem ok. Thanks in advance
  2. I am using delphi fmx for windows 10. I have listbox that will have list of messages. every message is inserted in that list box as a fmx frame. I decided to use this as a frame because I can get more nicer GUI look. I am simulating creating and deleting messages ( Frames ) by clicking on buttons. So I am basically making front end of the application and I want to make it good working before i actually hook it to internet. I am trying to practice oop and good design patterns so that is why i want to share with you how i did all this so you can give me suggestions how to improve. So I have listbox, when i click button1 i am triggering this code that will add 10 messages ( 10 frames ) to a listbox. for i := 0 to 10 do begin randNumb := Random(9900); messageList[randNumb] := TListBoxItem.Create(Self); messageList[randNumb].Parent := ListBox1; messageList[randNumb].Selectable := False; TFrame1.Create(Self).Name := IntToStr(randNumb); with TFrame1(FindComponent(IntToStr(randNumb))) do begin Parent := messageList[randNumb]; //Frame ID is public int property in Frame unit, i will need it later when I am deleting message ( frame ) frameId := randNumb; Label1.Text := 'Message body'; LabelName.Text := 'John Doe'; Country.Images := ImageList1; end; MessageList represents public property -> MessageList : Array [0 .. 9900] of TListBoxItem; I set array size from 0 to 9900... randNumb presents random number ( index ) that will be given to every messsage ( frame ) Property frameId have same value as name of the frame that i am creating dynamically. When I want to delete message ( frame ) I first click on the frame. When I click on the frame I am triggering OnClick event that is located in Frame unit, after that I am deleting message ( frame ) by using "DisposeOf". I have noticed that i also have to call "DisposeOf" not just on frame, i have to call it on MessageList also. So i am also doing MessageList[frameId].DisposeOf; and frame is deleted , also item in MessageList is deleted. ********************** Everything so far that I wrote is working but it does not feel right... 1. I want to add new message ( frame ) with an ID that is incremented by 1 compared to biggest index in my array. SO if i have 10 messages , when I add next message I want that message index to be 10+1 =11.. 2.Lets say that i have 10 messages , and i delete message with index of 5. What will happen with other message indexes ? is my MessageList array going to shrink or it will just leave empty space where is index 5 ? Will message that had index 6 before deleting message 5 go and drop down for one place and have index 5 ? will message with index 7 drop on 6th place and so on... ? 3.I could possibly make MessageList array with unknown length and everytime when i want to add new message i can check length of MessageList array and resize it for +1 and add that item on the end.. but still i have feeling that this is not a way to make this ... I was reading this : https://stackoverflow.com/questions/433221/how-do-i-declare-an-array-when-i-dont-know-the-length-until-run-time Third message says " If your array is no longer static, you might want to consider using a TList, a TStringList or one of the many container classes in the Contnrs unit. They may better represent what you are doing, provide additional capabilities you might need, e.g. sorting or name/value pairs, they dynamically grow as you need them, and have been very well optimized. " So my conclusion about this is that I have to find some correlation between TList or TStringList that i have to create and MessageList : Array [0 .. 9900] of TListBoxItem that I already created because my list of messages ( Frames ) will grow and shrink dynamically and I dont want to manually figure out how to do it.. I am not sure, maybe my whole concept is wrong from beginning Thank you for your help
  3. Hi, I found a way to sort my lists using Sort an OnCompare event but I don't figure out a functional way to use Sort(Compare) method (Rio 10.3.3) Any clues ? Thanks
×