lazarus gui main menu using forms? - pascal

i need to make a form where when a button is clicked then another form/page opens and from that for you can return to the original form in a similar fashion a main menu/sub menu works.
sorry im new to object pascal

Simply add the second form, and then in the button handler do a
secondform.showmodal;
Don't forget to add the unit where "Secondform" is in to the uses clauses of the first unit.

At the FreePascal Wiki you will find a tutorial on how to use Lazarus. You can read it in several different languages.
You can also see this Developing a GUI Application tutorial.

Related

MFC:CDHtmlDialog Purpose/Usages to open other views?

I was thinking of writing a new app where a users selects an option of what procedure they want to perform and the view changes to that until done then goes back to the main menu. I came across CDHtmlDialog and looked like a nice easy way to add a nice looking menu using html. But I wonder if that is the purpose of that class? Can I set it up so when a button or graphic link is clicked it changes out the view to another one (I would need to use traditional things like CTreeView with CListView with a splitter) or is it more for staying within the HTML world?
Thanks.
From the MSDN MSDN documentation
CDHtmlDialog Class is used to create dialog boxes that use HTML rather than dialog resources to implement their user interface.
From what I can gather from your post, I think you should consider SDI application using view classes that you want. To switch views on the command you do not need a splitter window. A static splitter is used to display a number of views in a different part of the splitter simultaneously.

CMFCPropertSheet with wizard mode

I'm trying to give some modernized look to a old MFC application. I have changed all the CPropertSheet and CPropertPages to CMFCPropertSheets and CMFCPropertPage.
I was success when using SetLook(CMFCPropertySheet::PropSheetLook_List); in normal mode.
Can I use CMFCPropertSHeet and CMFCPropertPages to get wizard mood looks as follows
use the CMFCPropertySheet::SetLook method with CMFCPropertySheet::PropSheetLook_List or whatever you want it to be,
since CMFCPropertySheet derives from CPropertySheet you can follow these instructions to do what you wanna achieve:
MSDN link: CPropertySheet
To create a wizard-type dialog box, follow the same steps that you would follow to create a standard property sheet, but call SetWizardMode before you call DoModal. To enable the wizard buttons, call SetWizardButtons, using flags to customize their function and appearance. To enable the Finish button, call SetFinishText after the user has taken action on the last page of the wizard.

! Simulating a button click - dealing with objects/classes/events

I have a python module abc.py which has numerous class and some class inherting from another classes. The entire file has classes that are connected to each other with objects/instantiation.
The function calls are all based off of GUI button clicks. So, functions get called in abc.py, when buttons are clicked.
I need to write a script which does exactly the same function of button clicking, but without me clicking on the actual GUI - you can imagine it automated.
The issue is, the button on the GUI, when clicked, an event is triggered and the button is associated with a function call "def button_press" which takes (self, event) as parameters.
How would I pass it self and event? I want to use the classes/functions in the module "abc.py" as is and also simulate the button click.. Could you give me some pointers on how I could do this?
Thanks
You can either:
Create an appropriate event, fill it with your test data and call self.button_press(your_test_event), from within your gui.
As above but from outside your gui call, app.topframe..button_press(your_test_event),
If your event handler does not use any data from the event then if you def button_press(self, evt=None) you can do a or b without creating an event first,
you can use any one of the excellent python GUI Test tools available - some are listed here.
You'll probably want to look at wx.PostEvent to send events to a button. Or if you're using wxPython 2.9.2 or better, then you can use the new UIActionSimulator, which you can read about here:
http://wxpython.org/Phoenix/docs/html/UIActionSimulator.html
I've heard a number of people who use sikuli for GUI testing. There's also COBRA, which I keep seeing listed on the Tested in Python user's group as a tool for GUI testing, although I'm not entirely sure if you can use it on a wxPython app.

Moving from one viewcontroller to another viewcontroller in Mac OS X using Xamarin.Mac

I am a complete newbie in Mac development. I want to achieve the following functionality :-
I have a view with a two textfields and a login button.When the user clicks on login button another view should open.
Now my main view is in MainWindow.xib file..
I added another view using
Add-> New File-> Xamarin.Mac-> Cocoa View with controller, which generated the following files:-
1.) NewView.cs
2.) NewView.xib
3.) NewViewController.cs
After searching quite a lot on net i did not get the exact way to achieve this functionality. I referred this thread
Easy Switching of "View Controllers" in Mac Apps (similar to iOS)
but could not get the much out of it. Can someone tell me how to simply navigate from one view controller to another using Xamarin.Mac and where what code is to be written??
Any links,code snippet or sample code will be of great help!!
Thanks a ton in advance!
Here is the answer :-
If you want to switch from one view to another below code snippet shows how to add and remove views:-
Write the below two lines in your Action of login button.
Previous view will be removed and new view i.e SecondView will be added.
this.View.Superview.AddSubview(new SecondViewController().View);
this.View.RemoveFromSuperview();
Cheers!!

How to create a view for a single control?

What is the best way to create a view for a single control that I need to load into a Shell region in a Prism app. I know I can wrap the control in a UserControl, but I suspect there may be a better way.
I am working on a demo app to learn Prism 4. Each module will load a navigation button into an ItemsControl in a region in the Shell. These navigation buttons will function like the Mail, Calendar, and other buttons in Outlook.
I am creating the view in each module that will hold the module's navigation button. The simplest way to create the view seems to be to wrap it in a UserControl. My question is this: Is there a better way to do it? Thanks for your help.
If you need graphical control, what you are doing is the way to go. If you find yourself making all of the buttons look the same (copy - pasting) you might find that a menu registration service is the way to go.
You'd have a service like IMenuService that you register with your container and modules can come around and register menu items to. You can then create buttons for the module. I've provided a sample for this here:
http://dl.getdropbox.com/u/376992/CAGMenus.zip
Your question, though, seems to be about whether or not you need to wrap a control in a UserControl to register them with a region? If that's the question, I believe the answer is no, although you might amend your question to tell us what you are running up against that makes you think this.
I ended up wrapping the control in a UserControl, and it seems to work fine. I am still interested in seeing if there is a better way to load the button, so I will hold this question open for a few days.
Edit 02/22/2011: I tried using a control without a UserControl wrapper, and I got the following error:
Library project file cannot specify ApplicationDefinition element.
I wrapped the control in a UserControl and the error went away.

Resources