![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 8 of 8 total |
![]() |
Thu, Jul 6 2017 10:25 AM | Permanent Link |
Matthew Jones | Okay, I have this pinned down - a TMenuControl with a sub-item, that does something to hide one of the sub-menu items, can cause a null access.
procedure TMenuControl.DoExit; var TempItem: TMenuItemControl; begin if (FItemIndex <> -1) then begin TempItem:=VisibleItems[FItemIndex]; TempItem.DoExit; end; inherited DoExit; end; If the sub-menu item has been hidden, then TempItem is null. This happens because the OnClick for the item causes the item to be made invisible. It is the last in the menu, so there is no "accidental" item to take its place. The simple solution is to check it is assigned, and if not, don't do anything. -- Matthew Jones |
Thu, Jul 6 2017 11:03 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Okay, I have this pinned down - a TMenuControl with a sub-item, that does something to hide one of the sub-menu items, can cause a null access. >> How about this ? procedure TMenuControl.DoEnter; var TempItem: TMenuItemControl; begin if (FItemIndex <> -1) and (FItemIndex < VisibleItemCount) then begin TempItem:=VisibleItems[FItemIndex]; TempItem.DoEnter; end else FirstItem; inherited DoEnter; end; procedure TMenuControl.DoExit; var TempItem: TMenuItemControl; begin if (FItemIndex <> -1) and (FItemIndex < VisibleItemCount) then begin TempItem:=VisibleItems[FItemIndex]; TempItem.DoExit; end; inherited DoExit; end; Tim Young Elevate Software www.elevatesoft.com |
Thu, Jul 6 2017 12:16 PM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> How about this ? I'll give it a go, but a simple if assigned(TempItem) then works just fine. -- Matthew Jones |
Thu, Jul 6 2017 1:51 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< I'll give it a go, but a simple if assigned(TempItem) then works just fine. >> Yes, I know, but the rest of the code elsewhere in the unit uses the VisibleItemCount check instead, so I'm trying to be consistent. Tim Young Elevate Software www.elevatesoft.com |
Fri, Jul 7 2017 9:25 AM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> How about this ? Confirmed working fine here. -- Matthew Jones |
Fri, Jul 7 2017 9:53 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Confirmed working fine here. >> Thanks - it's already uploaded and ready to use. ![]() Tim Young Elevate Software www.elevatesoft.com |
Fri, Jul 7 2017 9:59 AM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> Thanks - it's already uploaded and ready to use. ![]() I realise - it is the downloaded one I'm confirming! 8-) -- Matthew Jones |
Mon, Jul 10 2017 11:01 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< I realise - it is the downloaded one I'm confirming! 8-) >> Well played, sir. ![]() Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, April 23, 2025 at 06:31 AM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |