Luciano França Posted January 15, 2023 Share Posted January 15, 2023 I would like to know if there is any prediction of when it will be released ? Link to comment Share on other sites More sharing options...
Luciano França Posted January 24, 2023 Author Share Posted January 24, 2023 ? ? ? Link to comment Share on other sites More sharing options...
Sherzod Posted February 9, 2023 Share Posted February 9, 2023 1 Link to comment Share on other sites More sharing options...
Sherzod Posted February 10, 2023 Share Posted February 10, 2023 1. uses uniGUIJSUtils, System.JSON 2. procedure TMainForm.UniFormCreate(Sender: TObject); begin with UniPanel1, UniPanel1.JSInterface do begin AutoScroll := True; Caption := ''; JSInterface.JSConfigObject( 'items', [ 'xtype','dataview', 'reference', 'dataview', 'loadMask', True, 'plugins', JSObject(['ux-animated-dataview', True]), 'itemSelector', 'div.dataview-multisort-item', 'tpl', '<tpl for=".">'+ '<div style="float:left;padding: 8px;margin: 8px 8px 4px 8px;" class="dataview-multisort-item">'+ '<img id="{name}" class="_img" height="60" width="auto" src="{thumb}" oncontextmenu="document.getElementById(event.target.id).click(); return false"/>'+ '<h3>{name}</h3>'+ '</div>'+ '</tpl>', 'emptyText', '<span style="color: black; font-size: 14px;">There are no records to display', 'allowDeselect', True, 'listeners', JSObject([ 'select', JSFunction('sender, selected, eOpts', 'ajaxRequest('+ JSName +', "selected", {filename: selected.data.name, fileurl: selected.data.thumb})'), 'deselect', JSFunction('sender, records, eOpts', 'ajaxRequest('+ JSName +', "deselected", {})') ]), 'store', JSObject([ 'pageSize', 0, 'limit', 0, 'autoLoad', True, 'sortOnLoad', True, 'fields', JSArray(['name', 'thumb', 'url', 'type']), 'proxy', JSObject([ 'type', 'ajax', 'url', JSStatement(GetDataEventUrl(JSControl)), 'reader', JSObject([ 'type', 'json', 'rootProperty', '' ]) ]) ]) ]) end; end; 1 Link to comment Share on other sites More sharing options...
Sherzod Posted February 10, 2023 Share Posted February 10, 2023 3. procedure TMainForm.UniPanel1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'data' then begin UniSession.SendResponse(LoadImagesToJson('images')) end else if EventName = 'selected' then begin (Sender as TUniPanel).Title := Params.Values['filename'] + ' selected'; UniImage1.Url := Params.Values['fileurl'] end else if EventName = 'deselected' then begin (Sender as TUniPanel).Title := 'Not selected...'; UniImage1.Url := '' end; end; 4. initialization UniAddJSLibrary('build/packages/ux/classic/ux.js', False, [upoFolderJS, upoPlatformDesktop]); 1 Link to comment Share on other sites More sharing options...
Sherzod Posted February 10, 2023 Share Posted February 10, 2023 5. function TMainForm.LoadImagesToJson(APath: string): string; var ja: TJSONArray; jo: TJSONObject; procedure ProcessFileType(AJsonArray: TJSONArray; AFileMask: String); var _sr: TSearchRec; jo_file: TJSONObject; userImageFolder: String; begin userImageFolder := '.\files\' + APath + '\'; if FindFirst(userImageFolder + AFileMask, faAnyFile, _sr) =0 then begin repeat jo_file := TJSONObject.Create; jo_file.AddPair('name', _sr.Name); jo_file.AddPair('thumb', 'files/'+APath+'/'+_sr.Name); jo_file.AddPair('url', ReplaceStr(userImageFolder, '\', '/') + _sr.Name); AJsonArray.Add(jo_file); until FindNext(_sr) <> 0; FindClose(_sr); end; end; begin ja := TJSONArray.Create; ProcessFileType(ja, '*.gif'); ProcessFileType(ja, '*.jpg'); ProcessFileType(ja, '*.jpeg'); ProcessFileType(ja, '*.png'); ProcessFileType(ja, '*.svg'); if ja.Size > 0 then begin Result := ja.ToString; ja.Free; end else Result := '""'; end; 2 Link to comment Share on other sites More sharing options...
Stemon63 Posted February 10, 2023 Share Posted February 10, 2023 Hi Sherzod, I have the impression that having a UNIGUI component is better... 😄 1 Link to comment Share on other sites More sharing options...
Luciano França Posted February 15, 2023 Author Share Posted February 15, 2023 On 2/10/2023 at 2:36 AM, Sherzod said: 5. function TMainForm.LoadImagesToJson(APath: string): string; var ja: TJSONArray; jo: TJSONObject; procedure ProcessFileType(AJsonArray: TJSONArray; AFileMask: String); var _sr: TSearchRec; jo_file: TJSONObject; userImageFolder: String; begin userImageFolder := '.\files\' + APath + '\'; if FindFirst(userImageFolder + AFileMask, faAnyFile, _sr) =0 then begin repeat jo_file := TJSONObject.Create; jo_file.AddPair('name', _sr.Name); jo_file.AddPair('thumb', 'files/'+APath+'/'+_sr.Name); jo_file.AddPair('url', ReplaceStr(userImageFolder, '\', '/') + _sr.Name); AJsonArray.Add(jo_file); until FindNext(_sr) <> 0; FindClose(_sr); end; end; begin ja := TJSONArray.Create; ProcessFileType(ja, '*.gif'); ProcessFileType(ja, '*.jpg'); ProcessFileType(ja, '*.jpeg'); ProcessFileType(ja, '*.png'); ProcessFileType(ja, '*.svg'); if ja.Size > 0 then begin Result := ja.ToString; ja.Free; end else Result := '""'; end; Very grateful for the solution, However, since I am on the Roadmap, I would like to know if there will be a TListView component in the near future, if yes, in how long approximately ? Link to comment Share on other sites More sharing options...
Recommended Posts