Jean-Marc Kiener Posted August 4, 2020 Posted August 4, 2020 I have to create an assistant/wizard who take the user step by step (ca. 5 steps) through some forms (<<Back - next>>) to make an order. What is the best approach to achieve this? Put all on one form and work with a PageControl? Does this not results in hard to maintable code? Because it tends you to have all components, form logic and other buisness code in one form unit. You must have a large amount of self discipline to write clean code. Mostly i tends to “If then else..” orgy in event methods. Work with one Mainform and frames.? That's better because you can write code for each frame. In this project the mainform is just for showing the frames. Alle frames are inherited by one frame to share some design. Work with different forms? If you have to do a hybrid app that is the way you must go. You can achieve a Model-View-Controller pattern. It is the highest degree of separating form code from a form, because you have to make always two visible forms (one with unigui desktop and one with unigui mobile). So the code for steering the forms should be separated from the visible forms because you do not want it write twice. Since we decided not to go with a hybrid app, this approach is not necessary. But it is an nice and clear approach. Another approach? I try to find out how to organize my code so i have a clear approach but not that much overhead. 1 Quote
Abaksoft Posted August 4, 2020 Posted August 4, 2020 Hello Jean Marc, i really like this kind of topics. Never again coding with spaghetti code ! That is the resolution for a good developer. in major of unigui project, i am using your solution N°2 : - minimum code on each Frame - maximum code on a Class The class will have all necessary methods. This approach gives much clear code, easyer to maintain and valuable for hybrid project (Desktop and Mobile). Regards 2 Quote
Jean-Marc Kiener Posted August 4, 2020 Author Posted August 4, 2020 @Abaksoft Thank you for your opinion. That's really helpful for me to here from a such experienced user. Any other suggestions? Quote
Mehmet Emin Posted August 4, 2020 Posted August 4, 2020 9 hours ago, Abaksoft said: in major of unigui project, i am using your solution N°2 : - minimum code on each Frame - maximum code on a Class The class will have all necessary methods. This approach gives much clear code, easyer to maintain and valuable for hybrid project (Desktop and Mobile). I don't want to hijack your thread and change the subject but can we use Frames for mobile development? After seeing the difference in layout properties of desktop and mobile versions, I completely dismissed using frames for such cases under mobile. 1 Quote
Abaksoft Posted August 4, 2020 Posted August 4, 2020 1 hour ago, Mehmet Emin said: ... can we use Frames for mobile development? Yes. On the Right, Botom Side of IDE, juste Add a Frame on an Unigui Mobile Project. BTW, You are right, we impossible can remember all Unigui beautifull features. We are being to age ! Frames_Mobile.7z Frames_Mobile_2.7z 1 Quote
Mohammed Nasman Posted August 5, 2020 Posted August 5, 2020 Hello, I have used approach 2, but moved to 3. I'm using forms but embedded inside panel as it a frame, I only use frames for static data that will be shared across many forms. Forms has much more features and events, for example I use OnShow event to prepare some data 2 Quote
M.Ammar Posted August 6, 2020 Posted August 6, 2020 Hello , I have used the first Approach in 2 wizards , it is working fine with organizing each step code in {$REGION}, but I don't recommend it. in another wizard I mix between 1 and 3 (Especially good if you going to use existing forms and use them inside taps) I think you will be better off with no 3 it will be more manageable like Mohamed Nasman said regards 1 Quote
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.