d.bernaert Posted December 15, 2018 Share Posted December 15, 2018 Hello, I would like to create a framework for unigui applications that works as follows: 1. menu on the left side (no problem) 2. in the center of the screen, displaying of the module called from the left menu (no problem) 3. From this screen I need to be able to do inserts, modifications, searches using other forms. Key is I would like to avoid popup forms or modal forms. So the setup would be to have for instance the following: I select the option customer in the menu. In the central part of the screen I get a list of customers in a grid. From there I can create or modify a customer. Point is that I would like to display the edit or insert screen also in the central part of the screen without a pop-up. This is possible, but after the insert or modify, I need to redisplay the grid again with the modified customer. Does anybody have a framework or a setup to make this work? Thx in advance. Dominique Quote Link to comment Share on other sites More sharing options...
wprins Posted December 15, 2018 Share Posted December 15, 2018 Have a look at the "mdemo" "megademo" application which should give you some ideas. Also ask yourself how you would do this in conventional Delphi VCL. If you can describe/implement what you want in conventional Delphi then you can use essentially the same approach in UniGUI. But to make a further parenthetical comment: Your comment re "need to redisplay the grid again with the modified customer" suggests you simply need to notify or otherwise refresh the grid when the modification has completed. How that happens depends somewhat on on how/when the update completes. In a very general sense, you need some form of the "observer pattern", you need to "notify" the grid (an "observer") that its "subject" (the customer list) has changed, which would then trigger a refresh/repopulate/reopening of the dataset or whatever is required. Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 15, 2018 Author Share Posted December 15, 2018 Hi, thx, I now the megademo and created already quite a few applications using this strategy but always displaying the list of data in the mainform and updating in a modal form as I can trace the changes on the callback of the modal display. I will look into the observer pattern. Thx, Dominique Quote Link to comment Share on other sites More sharing options...
GerhardV Posted December 16, 2018 Share Posted December 16, 2018 Hi Dominique: I use the same approach but to achieve what you want I use a PageControl (Tabs) with the TabBar hidden. The grid is on the first tab and the "editing form/s" on subsequent tabs. So when the user clicks edit or add you change the PageControl's ActivePage property. When the user is done and click on save, the validations is done and the tabs are switched back and call a refresh on the data set. You just have to be careful and take precaution should the user navigates away from that by clicking on something else on the left menu. If that is fine then no worries. Of course all of this is done with frames. Gerhard Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 16, 2018 Author Share Posted December 16, 2018 Gerhard, thx, I was thinking in that direction. But how do i inform the first tab the second tab has completed and a refresh is needed? The update form can be used from different basic forms for instance. Also my second question, I've been using embedded forms on the tabs. Reason for this is that with frames I don't have a focus property or am i missing something? I would like to put the focus on the field i want when opening a tab with controls. Thx, Dominique Quote Link to comment Share on other sites More sharing options...
wprins Posted December 16, 2018 Share Posted December 16, 2018 4 hours ago, d.bernaert said: The update form can be used from different basic forms for instance. In the simplest way then, the update form must be given as parameter a callback routine (say "UpdateCustomers()") from the main form containing the grid, that it will call when it's done. Maybe as constructor parameter. Inside the update form, just prior to closing or after saving it then calls the this routine (locally maybe something like "If Assigned(Callback) then Callback()") which in turn results in UpdateCustomers on the form containing the grid being run. (This is a simplified "direct" implementation of a subject and observer directly handing each other a means of notification without "formalising" it and the pattern supporting multiple observers etc. as is the case in the general way this pattern is usually implemented.) Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 16, 2018 Author Share Posted December 16, 2018 Thx, will try this out. Quote Link to comment Share on other sites More sharing options...
Stemon63 Posted December 19, 2018 Share Posted December 19, 2018 A question: why I must use Pagecontrols with tab with unused active forms if you need only one form showed a time? All open forms in tab requires resources in server, or not? Benefit is only non reload the form on need, refreshing only data, but what about server memory and resources, with 50 tabs opened with a lot of components inside? Thx, Quote Link to comment Share on other sites More sharing options...
d.bernaert Posted December 19, 2018 Author Share Posted December 19, 2018 Indeed. But sometimes the user is working in a screen and from there he goes to another form which replaces the currently visible form. When finished, he wants to find the first screen again in the same state as it was before going to the second screen, only modified with the modifications done in the second screen. For instance, I'm in an data entry screen and the user has a field with a search button, I want to open the search form replacing the entry screen and after selecting the wanted data, I want to return to the first screen only changing the form with the selected data. Dominique 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.