Delphi control that could mimic “Add-ons|Extension

2019-01-11 11:41发布

My aim is to update the look of the GUI in my app. Currently my GUI contains a lot of listboxes which are used to edit some objects in an old fashioned way, that is, user double-clicks an item and a dialog is shown to modify the corresponding object.

I think a good modern approach is how Firefox displays the extensions installed (a snapshot below).

My question is about how to build such a GUI in Delphi(win32) easily? Are there any components you use mimicing such behaviour or will I just need to code this from stratch using panels? (IMO a very cumbersome job I'd like to avoid - the selection logic, resizings, etc...)

alt text http://i41.tinypic.com/16k6gd5.png

5条回答
【Aperson】
2楼-- · 2019-01-11 12:19

Using a TFrame for each list item and put them all Aligned Top on a TScrollBox might work. Also see TDBCtrlGrid which does something like that in combination with datasets.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-01-11 12:24

If you're using Delphi 2007 or Delphi 2009, you might be able to do something similar using TCategoryButtons (from the 'Additional' component palette page). Drop it on a form and right click to display the popup menu, and then click "Categories Editor...". Add a category with the resulting dialog, set it's caption, and optionally set up Items it contains. Not exactly the same, but it might do what you need.

You could also use a dialog with a TTreeView (if you have categories of objects) or TListView to emulate the Delphi 2007 Projects->Options dialog. Clicking an item in the TreeView or ListView displays the proper page of a TPageControl to configure the object.

查看更多
放我归山
4楼-- · 2019-01-11 12:28

It can be done with existing Delphi controls.

For instance in the TCustomListBox control you can create your own OnDrawItem event to draw your own list item. You also need to create your own OnMeasureItem to change the item height.

In some cases it is very limited, so if you want more freedom you will need to do it from scratch.

查看更多
smile是对你的礼貌
5楼-- · 2019-01-11 12:29

I mostly agree with Lars, but I would use a frame for each item instead of a panel. That would separate into its own file, and you would get easy designtime support for it.

查看更多
该账号已被封号
6楼-- · 2019-01-11 12:40

You can do something similar (not exactly) with standard components; TDBCtrlGrid, TSpeedButton,...

alt text http://img8.imageshack.us/img8/9585/imagen29ox3.png

查看更多
登录 后发表回答