Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 11 total |
Custom Panel Component creation help required |
Fri, Jan 22 2016 10:41 AM | Permanent Link |
Trinione | Being new Custom Component creation, stuff like CreateInterfaceElements; override... UpdateInterfaceState; override; etc, is all new to me. Unlike Delphi though, I am picking up the flow of EWB interface/components pretty easily.
Have learned a lot from the videos and looking at the code, but some direction from the gurus would go a long way in saving dozens of (more) hours. I have created a new interface file, TMyBasicPanel.wbi, and new related component. However, when I add the component to the form at design-time, it shows a Basic Panel . (1) How to display the TMyBasicPanel interface and not TBasicPanel interface. (2) How to select the Image | Name object property selection for the Picture (3) How to display the selected picture in the UserPicture element. Attached is a tiny specific project with interface file included. Attachments: MyBasicPanel.zip |
Fri, Jan 22 2016 2:59 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << (1) How to display the TMyBasicPanel interface and not TBasicPanel interface. >>
You're missing the GetInterfaceClassName override: function TMyBasicPanel.GetInterfaceClassName: String; begin Result:=TMyBasicPanel.ClassName; end; and also add the method override to the protected section: TMyBasicPanel = class(TBasicPanel) private { Private declarations } FUsernameElement: TElement; FUserPictureElement: TElement; FUsername: string; FUserPicture: string; function GetUsername: string; procedure SetUsername(const Value: string); function GetUserPicture: string; procedure SetUserPicture(const Value: string); protected { Protected declarations } property UsernameElement: TElement read FUsernameElement; property UserPictureElement: TElement read FUserPictureElement; procedure CreateInterfaceElements; override; procedure UpdateInterfaceState; override; function GetInterfaceClassName: String; override; <<<<<<<<<<<<<<<<<<<<<<< Here ! public << (2) How to select the Image | Name object property selection for the Picture >> You can't. You can only provide a URL for an image or surface the Background.Image property as a property from your underlying image element. << (3) How to display the selected picture in the UserPicture element. >> See 2). If you choose to use the Background.Image route, then you'll need to make sure that the images used are small. But, the display at design-time is automatic, and you don't need to do anything else. Tim Young Elevate Software www.elevatesoft.com |
Fri, Jan 22 2016 7:05 PM | Permanent Link |
Trinione | Tim:
<< You're missing the GetInterfaceClassName override: >> Added it. Now I am seeing the correct Interface. However, not seeing the Elements in design-time, and at run time the UsernameElement is positioned in the TopLeft corner. ??? << surface the Background.Image property as a property from your underlying image element. >> I have changed it to: property UserPicture: TBackground read FUserPicture; However, it shows the '+' sign next to the property, but clicking on it does nothing more than change it to a '-' sign. No other properties appear. Trust that I have spent the past 3 hours trying to get it to appear before posting this. I am really trying here. LOL |
Fri, Jan 22 2016 7:12 PM | Permanent Link |
Trinione | << However, not seeing the Elements in design-time, and at run time the UsernameElement is positioned in the TopLeft corner >>
FIXED! I had the wrong value defined for the Const. Its now USERNAME_ELEMENT_NAME = 'Username'; <----- << surface the Background.Image property as a property from your underlying image element. >> Still an issue as described in previous post. |
Fri, Jan 22 2016 9:26 PM | Permanent Link |
Trinione | Tim:
<< surface the Background.Image property as a property from your underlying image element. >> I am almost ashamed to say I fixed it. Hours later... I realise I am a victim of the infamous 'Rookey Mistakes'. Failed to rename the Element in the Interface to 'UserPicture'. It was Element1. Works perfectly fine now. Thanks. |
Fri, Jan 22 2016 10:04 PM | Permanent Link |
Trinione | Tim:
Could not get the UserPicture to work for the longest time. Just for the desperate heck of it I switched the order to match the Interface Layout order in the CreateInterfaceElements procedure. From: FUsernameElement := InterfaceManager.CreateElement(USERNAME_ELEMENT_NAME, ... FUserPictureElement := InterfaceManager.CreateElement(USER_PICTURE_ELEMENT_NAME... To: FUserPictureElement := InterfaceManager.CreateElement(USER_PICTURE_ELEMENT_NAME... FUsernameElement := InterfaceManager.CreateElement(USERNAME_ELEMENT_NAME, ... and it NOW works. I guess that is one of the Rules? Elements in the CreateInterfaceElements procedure must match the Layout order of the Interface? |
Sat, Jan 23 2016 12:49 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << I guess that is one of the Rules? Elements in the CreateInterfaceElements procedure must match the Layout order of the Interface? >> Yes, at least for now. It's something that I want to correct, though, because you're the second person to run into this issue. Tim Young Elevate Software www.elevatesoft.com |
Mon, Jan 25 2016 2:13 AM | Permanent Link |
Trinione | << Yes, at least for now. It's something that I want to correct, though, because you're the second person to run into this issue. >>
Tim: I spent all day trying to get the attached custom component to work. However, no matter the order I put it in, the component never showed up correctly. I am seeing the changes to the Object properties changing accordingly. However, it never shows up right. I expect its the ordering, but I believe its in the correct order. I am attempting to add a MessageTimestamped element to the top. (This is a component I was working on in another thread). Attachments: MyBalloonLabel.zip |
Mon, Jan 25 2016 8:39 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << I spent all day trying to get the attached custom component to work. However, no matter the order I put it in, the component never showed up correctly. I am seeing the changes to the Object properties changing accordingly. However, it never shows up right. >>
There are a couple of problems here: 1) You're descending from the TBalloonLabel control, but you're re-creating UI elements that are already created in the ancestor class. You either need to descend from TControl, or only create the UI elements that are *additional* UI elements added by your descendant class. 2) Even if you straighten out 1), you're still going to probably have issues with adding your message timestamp in terms of how the layout is automatically computed. You'll need to replicate what's in TBalloonLabel.UpdateLayout so that it takes into account your additional UI element in terms of auto-sizing. In general, the main issue is that TBalloonLabel wasn't really designed for proper sub-classing, so it needs some updating to enable this to all work smoothly with a minimal amount of code. Tim Young Elevate Software www.elevatesoft.com |
Mon, Jan 25 2016 5:38 PM | Permanent Link |
Trinione | << 1) You're descending from the TBalloonLabel control, but you're re-creating UI elements that are already created in the ancestor class. You either need to descend from TControl, or only create the UI elements that are *additional* UI elements added by your descendant class. >>
That's exactly what I thought, but since the ordering is important I added them in here also. << 2) Even if you straighten out 1), you're still going to probably.......... minimal amount of code. >> Correct. << In general, the main issue is that TBalloonLabel wasn't really designed for proper sub-classing, so it needs some updating to enable this to all work smoothly with a minimal amount of code. >> I was working on the premise that all components had this ability. Seems I was on the right track but TBalloonLabel sub-classing is not designed as such at this time. What I shall do is sub-class based on the TPanel componet as I designed for this. I am assuming Gutter, Icon and Arrow elements in the new interface and the relevant component code should work fine. |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, April 23, 2024 at 08:10 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |