SergioFeitoza Posted February 20, 2019 Share Posted February 20, 2019 (edited) I'm using and learning with the great demo AllFeaturesDemo. Very well done. On the left side of the Main scree there is the Treeview . I just I want to create a new “Forms” item in the ThreeView but named “FormsNew” . I want to create the new one but maintaining the existing one ( not only to rename the existing one). The new one should be exactly as the existing one except for the ttle. I made a few attempts but the new item did not appear in the Treview. I made the attempt just by creating new files in the Units directory thinking that the code in ConstructNavigator procedure (in Main unit) would do the rest alone. However did not work and seems I am missing something. Can anyone help me ? Congratulations to the authors. Unigui is great . I bought it few minutes ago *** Putting the question in another way: " What is the method used to create the TreeView in the demo . Seems to be an "automatic" one based on the names of the files in the units. Is it this ? If not in which part of the code the Treeview items are created? Edited February 20, 2019 by SergioFeitoza Complementing text Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 21, 2019 Share Posted February 21, 2019 Hello, Thank you! Thank you for your interest in UniGUI! 18 hours ago, SergioFeitoza said: thinking that the code in ConstructNavigator procedure (in Main unit) Yes 18 hours ago, SergioFeitoza said: Putting the question in another way: " What is the method used to create the TreeView in the demo . Seems to be an "automatic" one based on the names of the files in the units. Is it this ? If not in which part of the code the Treeview items are created? Please see the beginning of each module: // Action List = Actions <------------------ unit ActionListActions; {$I uniCompilers.inc} interface ... //Labels = Form Controls <------------------ unit FormControlsLabels; interface ... ... Ls := TStringList.Create; try if SysUtils.FindFirst(Path+'*.pas', faAnyFile, sr) = 0 then begin repeat if (sr.Attr and faDirectory) = 0 then begin AssignFile(Txt, Path + Sr.Name); Reset(Txt); ReadLn(Txt, RawS); CloseFile(Txt); S := DecodeCharSet(RawS, 'utf-8'); iPos := Pos('//', S); S := Trim(Copy(S, iPos + 2, MaxInt)); iPos := Pos('=', S); if iPos > 0 then begin S1 := Trim(Copy(S, 1, iPos - 1)); S := Trim(Copy(S, iPos+1, MaxInt)); Ls.Add(S + '=' + S1); FileNames.Values[S1] := ExtractFileNameNoExt(Sr.Name); end; end; until FindNext(sr) <> 0; FindClose(sr); end; ... Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted February 21, 2019 Author Share Posted February 21, 2019 Dear Sherzode. Thank you for your answer. It does not clarify my doubt. Possibly my explanation was not clear enough and here I explain better details. Please remain focused just on the demo AllFeaturesDemo. Before posting my doubt I went to the two procedures you mention above (and to many others). I wanted to identify from where came the items and subitems of the treeview of the demo. As I did not find any list pre-prepared in "design time" with titles and subtitles I imagined that they were created dynamically. Question 1: Am I right or wrong on this ? Is there a list of items/subitems prepared in “design time” which is imported to the Treeview in the Procedure TMainForm.ConstructNavigator; or some other place ? If affirmative where is it ? If there is no list prepared in “design time” a possibility that I could imagine is that the app goes “in run-time” to the directory UNITS and look to the titles of the units (each one is one sub item of the tree view) and from those titles it creates the titles of the items and subitems of the tree list ( in the same procedure ConstructNavigator). Question 2: If my assumption is correct, how to create a new node named like "HPL_MVSW1_" with a subitem under it like "Temperature_Rise". I tried to do this but instead of appearing a new ITEM with the name. Please see a detailed figure attached showing the steps I did Question 3: If .my assumption is NOT correct please explain how I can create a new item using the same process used in the original demo. Thank you in advance Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 21, 2019 Share Posted February 21, 2019 You must register your class in the initialization section Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted February 21, 2019 Author Share Posted February 21, 2019 Your response is so resumed that I am still with the doubt. When I created the new unit (new treeview item) I did the "register of my class in the initialization section". I imagine that when you write “my class” you are referring to the new form /new item of the treeview. Please read below the last lines of the new unit. If it is not this try to tell me what I should write and where Is it possible for you to , at least, say YES or NO in the three question above ? // Dynamic Form = Forms unit HPL_MVSW1_Temperature_Rise; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIFrame, uniStatusBar, uniButton, uniGUIBaseClasses, uniPanel, StdCtrls, ComCtrls, uniGUIRegClasses, DynamicUnit; type THPL_MVSW1_Temperature_Rise = class(TUniFrame) UniContainerPanel1: TUniContainerPanel; UniButton1: TUniButton; procedure UniButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation uses UniGUIVars, MainModule, uniGUIApplication; {$R *.dfm} procedure THPL_MVSW1_Temperature_Rise.UniButton1Click(Sender: TObject); begin UniForm4.Show; end; initialization RegisterClass(THPL_MVSW1_Temperature_Rise); end. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 21, 2019 Share Posted February 21, 2019 Hi, I'm sorry if I didn't give the exact answer Can you please create a simple testcase for your issue?! Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted February 21, 2019 Author Share Posted February 21, 2019 Dear Sherzod some two hours ago I posted an answer to you reply and left the room when the attachment was uploading. Now I arrived back and as I do not see the Post in the Forum maybe there was a problem when uploading. Then I will write again. Attached is the test case you requested. It is a zipped file equal to the AllFeaturesDemo in the Unigui site demo . There is only the addition of two files in the directory UNITS of the demo. I call it AllFeaturesSergio The files are FormsSergioDynamicFormSergio ( pas + dfm). They correspond to the additional treeview item and subitem I want to include automatically (and not using the component tool to add in design time). The result I want to see is simply the one presented in the attached figure. If possible, please revise the code in the zipped file and send me back ( **) the zipped file is after Regards Sergio Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted February 21, 2019 Author Share Posted February 21, 2019 The zipped file AllFeaturesSergio.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 21, 2019 Share Posted February 21, 2019 // Dynamic Form Sergio = Forms Sergio unit FormsSergioDynamicFormSergio; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses, uniGUIClasses, uniGUIFrame, uniStatusBar, uniButton, uniGUIBaseClasses, uniPanel, StdCtrls, ComCtrls, uniGUIRegClasses, DynamicUnit; type TUniFormsSergioDynamicFormSergio = class(TUniFrame) UniContainerPanel1: TUniContainerPanel; UniButton1: TUniButton; procedure UniButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation uses UniGUIVars, MainModule, uniGUIApplication; {$R *.dfm} procedure TUniFormsSergioDynamicFormSergio.UniButton1Click(Sender: TObject); begin UniForm4.Show; end; initialization RegisterClass(TUniFormsSergioDynamicFormSergio); end. Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted February 21, 2019 Author Share Posted February 21, 2019 I will try another solution which I can manage alone because the answers I receive here from support are almost impossible to undertand . Seems that support do not have time to read what we write or to write what we read. This need to be improved by Unigui team So, here is my my last question in this topic. It is an objective question If I open the code of Unigui demo AllFeaturesDemo and open unit MAIN.PAS and click F12 I see the form. If I click "view as text" I can find text below QUESTION : where it is recorded , in the files of the code, the content of NavTree.Items.NodeData ????? This is what I am asking in these many posts , drawings and texts;. This should not be difficult to answer. object NavTree: TUniTreeView Left = 1 Top = 52 Width = 238 Height = 605 Hint = '' Items.NodeData = { 03020000002E0000000000000000000000FFFFFFFFFFFFFFFF00000000000000 000500000001084800500020004D0056005300570031003E0000000000000000 000000FFFFFFFFFFFFFFFF0000000000000000000000000110540065006D0070 0065007200610074007500720065002000520069007300650036000000000000 0000000000FFFFFFFFFFFFFFFF000000000000000000000000010C49006E0074 00650072006E0061006C002000410072006300460000000000000000000000FF FFFFFFFFFFFFFF0000000000000000000000000114530068006F00720074002D 006300690072006300750069007400200066006F0072006300650073003A0000 000000000000000000FFFFFFFFFFFFFFFF000000000000000000000000010E4D 00610067006E00650074006900630020004600690065006C0064003A00000000 00000000000000FFFFFFFFFFFFFFFF000000000000000000000000010E45006C 0065006300740072006900630020004600690065006C0064002E000000000000 0000000000FFFFFFFFFFFFFFFF00000000000000000500000001084800500020 004D0056005300570032003E0000000000000000000000FFFFFFFFFFFFFFFF00 00000000000000000000000110540065006D0070006500720061007400750072 00650020005200690073006500360000000000000000000000FFFFFFFFFFFFFF FF000000000000000000000000010C49006E007400650072006E0061006C0020 00410072006300460000000000000000000000FFFFFFFFFFFFFFFF0000000000 000000000000000114530068006F00720074002D006300690072006300750069 007400200066006F0072006300650073003A0000000000000000000000FFFFFF FFFFFFFFFF000000000000000000000000010E4D00610067006E006500740069 00630020004600690065006C0064003A0000000000000000000000FFFFFFFFFF FFFFFF000000000000000000000000010E45006C006500630074007200690063 0020004600690065006C006400} Items.FontData = { 01020000001E000000050000000700000000080000FFF3FFFFFF000000000000 43616C69627269FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FF FFFFFF00000000FFFFFFFF00000000FFFFFFFF05000000FFFFFFFF00000000FF FFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000} Images = UniNativeImageList2 Align = alClient TabOrder = 1 ScreenMask.ShowMessage = False ScreenMask.Target = Owner ScreenMask.Color = clWhite ScreenMask.Opacity = 0.200000002980232200 Color = clWindow BorderStyle = ubsNone OnLoaded = NavTreeLoaded OnClick = NavTreeClick OnCellContextClick = NavTreeCellContextClick end Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted February 23, 2019 Author Share Posted February 23, 2019 SOLVED The treview items are not recorded They are created in run time through the titles of the procedures in the UNITS directory. The trick is the "commented" first line of the code which is used in the Procedure ConstructNavigator , in this part S := DecodeCharSet(RawS, 'utf-8'); iPos := Pos('//', S); S := Trim(Copy(S, iPos + 2, MaxInt)); iPos := Pos('=', S Good solution but not didatic Quote Link to comment Share on other sites More sharing options...
jackyhuynh Posted September 10, 2021 Share Posted September 10, 2021 On 2/22/2019 at 2:48 AM, SergioFeitoza said: The zipped file AllFeaturesSergio.zip SergioFeitoza , could you share again this file, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.