I'm making a toolbox type thing. The modeless dialog should sit on top of the screen and provide selection options then the main form should carry out options based on which button was pushed. How do I determine what button is selected from the modeless dialog in the main form??
Determining A Selected Button In a Modeless Form In the Main From
82 Views Asked by Zachary M Judkins At
1
There are 1 best solutions below
Related Questions in C#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in TRANSFER
- Copy data between two linked servers
- Data transfer between Ubuntu/Windows to network
- How can I make a transfer function for an RC circuit in python
- Data transfer between fpga (14 bits) vhdl block to NIos II system (16 bits)
- iOS transfer app from ad hoc to Enterprise on another account
- transfer magento website from one domain to another
- Transferring an Xcode project to another computer with all files/frameworks
- Is there anyway to transfer html elements from one client to another with keeping of every entered values like in textboxes?
- Automatic Transfer of Token in Solidity Contract
- Z-Transform Poles and Zeros Locations on MATLAB
- Python26 script to grab a file from remote host
- Robocopy script to transfer user data from old PC to new PC
- Drupal 7 - How to transfer webform's data to a content type?
- SFTP file lock mechanism
- Android Application Distribution / Upgrade
Related Questions in MODELESS
- PyQt4: Wait on modeless dialog
- how to create a modeless dialog in tcl/tk
- How do I make a JMessageDialog not force the user to close it before switching panels in my GUI?
- How close and delete a modeless qt dialog
- MFC modeless and modal dialog
- difference between modal and modeless dialogs in MFC
- MFC modeless dialog close immediately
- Missing WM_LBUTTONDOWN
- Why is a modal/modeless dialog called modal/modeless?
- How to call IsDialogMessage in a Modal Dialog
- Visual C++ Modeless Dialog Bitmap Not Showing
- html popup google.script.run works for me but not others who make a copy of the workbook
- Call AfxGetMainWnd() from derived class of DialogEx returns NULL
- WPF modeless dialog renders textbox uneditable
- Can't select text in HTA modeless dialog
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You have an event handler on the modeless dialog wired up to each button. When a button is clicked/toggled, this event handler will fire, thus telling you that the button was clicked/toggled.
You will then probably want to forward this notification on to your parent window. You can do this by calling an event handler on your main form, passing the identifier of the currently selected button as part of the event arguments. The only tricky part here is that, in order to call an event handler on the main form, the floating palette form will have to maintain a reference to the main form. You can do this manually, but there is no need to do so, since the floating palette will always need to be owned by the main dialog (to ensure that it actually floats on top of it in the Z order), so you can simply retrieve a reference to the main dialog by using the floating palette's
Ownerproperty. Cast it to the type of the main form, and raise the event. Process the event as desired in an event handler function defined for the main form class.If you don't need to receive a notification on your main form, you can just track the state in the floating palette form and read it from the main form when you need to know what it is. This will require that the main form keep a reference to the floating palette. The easiest way of doing this is to have a member variable for the main form class that contains an instance of the floating palette form. This is the best design anyway, and will facilitate your ability to access/set data on the floating palette from the main form. It does slightly increase coupling, which some would say is an object-oriented design smell, but these two objects are, in reality, very tightly coupled, so this is really not a problem.
You'll notice that several places above I refer to your "modeless form" as a "floating palette". That's because the design you're describing is actually a rather common scenario in complex applications like Photoshop that have floating palette windows from which you can choose a tool. Paint.NET (written in C#) does exactly this, too, and probably implements it much as I've described.
The biggest thing that trips up new C# programmers is understanding the difference between a class and an instance of a class. The class is an abstract object—it contains all the necessary information for creating an object. The instance is the actual object itself. There is only one class definition for each class type, but there can be multiple instances/objects of each class type. For example, consider that you have a main form class named
MainForm. This contains all of the code (events, properties, methods, etc.) for your main form. This is a class. In order to actually display or interact with your main form, you will need to create an instance of thatMainFormclass. The problem that beginning programmers have is trying to access properties or call functions on the class itself, rather than an instance (object) of the class. This is why I am careful to say that you need to maintain a reference to the floating palette—by this I mean your specific instance of the floating palette form class. Make sure that you understand this distinction; consult your favorite text on programming in C# (or any other object-oriented language) for more information.