Build better business applications with NAV
CurrForm.Frame1.XPOS := 0;
CurrForm.Frame1.YPOS := 0;
CurrForm.Frame2.XPOS := 0;
CurrForm.Frame2.YPOS := 0;
CurrForm.Frame3.XPOS := 0;
CurrForm.Frame3.YPOS := 0;
CurrForm.HEIGHT := CurrForm.Cancel.YPOS +
CurrForm.Cancel.HEIGHT + 220;
CurrForm.WIDTH := CurrForm.Cancel.XPOS +
CurrForm.Cancel.WIDTH + 220;
WizardStep := 1;
ShowStep(TRUE);
CASE WizardStep OF
1: BEGIN
CurrForm.Frame1.VISIBLE := Show;
CurrForm.Frame2.VISIBLE := NOT Show;
CurrForm.Frame3.VISIBLE := NOT Show;
CurrForm.Back.ENABLED := NOT Show;
CurrForm.Next.ENABLED := Show;
CurrForm.Finish.ENABLED := NOT Show;
END;
2: BEGIN
CurrForm.Frame1.VISIBLE := NOT Show;
CurrForm.Frame2.VISIBLE := Show;
CurrForm.Frame3.VISIBLE := NOT Show;
CurrForm.Back.ENABLED := Show;
CurrForm.Next.ENABLED := Show;
CurrForm.Finish.ENABLED := NOT Show;
END;
3: BEGIN
CurrForm.Frame1.VISIBLE := NOT Show;
CurrForm.Frame2.VISIBLE := NOT Show;
CurrForm.Frame3.VISIBLE := Show;
CurrForm.Back.ENABLED := Show;
CurrForm.Next.ENABLED := NOT Show;
CurrForm.Finish.ENABLED := Show;
END;
END;
ShowStep(FALSE);
WizardStep -= 1;
ShowStep(TRUE);
ShowStep(FALSE);
WizardStep -= 1;
ShowStep(TRUE);
CurrForm.CLOSE;
CurrForm.CLOSE
The form contains three frames, only one of which is visible at any given time. In the design view, you can see that our form is quite wide and tall, but that would not look right when displaying a wizard form. That’s why we place code in the OnOpenForm trigger.
The first set of lines places all of the frames on top of each other. The middle set changes the width and height of the form. Finally, the third sets the appropriate frames to be visible or not and enables the correct buttons.
Our custom method ShowStep decides what should be visible and what should not. It is just a large CASE statement based on the WizardStep variable. On the first frame for example, we can’t move backwards to disable the Back button. We can’t finish until we get to the last frame so that the Finish button is disabled until that point.
On the Back and Next buttons we decrement and increment the WizardStep variable so that the ShowStep method knows what to do. Other than the initial opening of the form we always call the function with FALSE as a parameter to “undo” what is currently displayed, change the WizardStep variable, and call the function with parameter TRUE to display new information.
In this part of the article series we covered:
In the next part we will cover Updating Parent and Subform.
Further resources on this subject:
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…