In the code I create the TIWCGJQMenu object, set a few properties, add two sub-items for Open (Download) and Delete and then assign that object to the region. I need the scroll bars to appear when I add more items to the TIWCGJQRegion than there is vertical room to display.
- Code: Select all
procedure TframeEmailEdit.LoadLinkedDocuments;
var
strFolder, strFilename, strCaption: String;
slLinkedDocuments: TStringList;
itemLinkedDocument: TIWCGJQMenu;
itemDocument: TIWCGJQMenuItem;
itemSubMenu: TIWCGJQMenuItem;
i: Integer;
begin
strFolder := UserSession.GetEmailLinkedDocumentsFolder(Self.FEmailID);
Self.fileUploadLinkedDocument.JQFileUploadOptions.UploadPath := strFolder;
Self.fileUploadLinkedDocument.JQFileUploadOptions.OnUpload.Indicator := Self.FLockIndicator;
slLinkedDocuments := TStringList.Create;
S2Snax.GetFileList(strFolder, False, '*.*', slLinkedDocuments);
Self.FAttachedFileCount := slLinkedDocuments.Count;
ForceDirectories(strFolder);
Self.KillLinkedDocumentsList;
for i := 0 to slLinkedDocuments.Count - 1 do
begin
itemLinkedDocument := TIWCGJQMenu.Create(Self);
itemLInkedDocument.Parent := Self.regionLinkedDocuments;
itemLinkedDocument.Name := FindUniqueName;
itemLinkedDocument.Align := TAlign.alTop;
strFilename := slLinkedDocuments[i];
strCaption := '<html>' +
'<body>' +
'<div id="container" style="width:' + IntToStr(Self.regionLinkedDocuments.Width) + 'px">' +
'<div id="col1" style="width:'+IntToStr(Self.regionLinkedDocuments.Width div 2)+'px;float:left;">' +
ExtractFileName(strFilename) + '<br>' +
'</div>' +
'<div id="col2" style="width:'+IntToStr(Self.regionLinkedDocuments.Width div 4)+'px;float:left;">' +
FormatDateTime('MM/DD/YYYY HH:MM:SS AM/PM', S2Snax.GetFileDate(strFilename)) + '<br>' +
'</div>' +
'<div id="col3" style="width:'+IntToStr(Self.regionLinkedDocuments.Width div 4)+'px;float:left;">' +
S2Snax.RealToString(RoundTo(S2Snax.GetFileSize(strFilename) / 1024,-2)) + ' KB' + '<br>' +
'</div>' +
'</div>' +
'</body>' +
'</html>';
itemDocument := itemLInkedDocument.MenuItems.Add;
itemDocument.Caption := strCaption;
itemSubMenu := itemDocument.SubItems.Add;
itemSubMenu.Caption := 'Open ' + ExtractFilename(strFilename);
itemSubMenu.InternalData := strFilename;
itemSubMenu.OnClick.OnEvent := Self.LinkedDocumentOpenClick;
itemSubMenu := itemDocument.SubItems.Add;
itemSubMenu.Caption := 'Delete ' + ExtractFilename(strFilename);
itemSubMenu.OnClick.OnEvent := Self.LinkedDocumentDeleteClick;
itemSubMenu.InternalData := strFilename;
end;
end;
Anybody have a suggestion?
Thanks,
Scott