Modal forms get in the way of processing - forms

I’m working on an interface in VB6 to interact with a sound editor to automate certain tasks mainly using the editor’s object handles and activating them through SendMessage/PostMessage. In general it works OK, except that the editor has some dialog boxes that open in modal mode and freeze everything on the interface, including the timers.
Is there a practical way to get these dialog boxes to open modeless or to interact with them from the interface after they pop up? I tried an MDI form, but it also freezes along with everything else. The only way to override the modal mode of these boxes is to launch an independent applet beforehand to address the dialog boxes with a timer, but the process is somewhat cumbersome.
All I need to do with the dialog boxes is click the OK button or hit the return key.

The Form.Show method excepts an optional style parameter that determines if the form is modal or modeless. You can pass it the intrinsic constant vbModeless.
Form1.Show vbModeless

It's a difficult question to answer without understanding the context of the dialog boxes. However, if you don't want the dialog to stall the execution of your program, I think the only way is to run your app from a different thread (start and Active X exe or something) and then make calls across to the other thread.

Related

How to force a delphi form to be in foreground in windows 10 tablet mode

This is the setting:
I have two views that are implemented within two different vcl forms. To one of those I applied a style to make it look like a touch optimized metro app.
Those forms can be switched according to an application's setting. (show touch optimized view on/off)
this works pretty good. I override Application.MainForm, the old form closes, the new form appears (and takes the focus).
I want this to be automated in Windows 10. As additional view mode I offer an option "Auto detect":
I am listening for the windows message WM_SETTINGCHANGE. This is sent by switching between desktop mode and tablet mode.
Then I check the registry for the value of HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell\TabletMode
If it's 1 I switch to the touch optimized view.
And this is the problem:
The old form is destroyed, the new form pops up and Application.MainForm references the new form.
Buf afterwards also the start screen of the tablet mode pops up and shows itself on the very top of all windows.
So my new touch optimized form disappears behind this screen and loses the focus. This behavior doesn't appear if I set the view fixed to the desktop view and switch windows 10 into tablet mode. in this case, my application keeps the focus and maximizes itself (that way there's no form created of course).
What I've tried so far:
The most obvious approach would be a call of
Application.MainForm.BringToFront.This doesn't work.
My second approach was to create a hidden "helperform" that takes FormStyle := fsStayOnTop (this way the focus should be taken) and calls SetForeground(Application.MainForm.Handle) from WinAPI.
any ideas?

forms showing in runtime as soon as they are created

In runtime when the forms are being created, 2 forms constantly keep appearing when I haven't programmed them to show as soon as they are created, and my system runs. I was wondering why this happened and whether there is anything to solve this? I don't think I need to show my code here since it's pretty basic and there is none for the OnCreate event.
From the main menu, use Project->Options->Forms, and remove the forms you don't want to see from the Auto-create list. (Click the >> button to move them from the left side to the right side.)
(It's worth mentioning that you can also affect the order in which any autocreated forms or datamodules are created from that dialog by just dragging them up or down in the list. Note that the first form to be created becomes the application main form, so when it is closed the application will close as well; this means that the only thing above your main form in the autocreate list should be datamodule(s) that are accessed by the main form.)
If you never want any forms auto-created, go to Tools->Options->Environment Options->Form Designer, and uncheck the very last item labeled Auto create forms & data modules at the bottom. Note that your main form will always be auto-created, as it's what controls the application's lifetime for form based applications.
By default delphi creates all the forms in the beginning. You can open the .dpr file and delete the ones that you don't need. You could also do that from the UI.
For the forms that you don't want to appear at the start of runtime, go to the properties of the form (lower left hand side) and uncheck Visible. This should do the trick

What is the opposite of topmost in GTK+?

In WindowsForms there is a property called TopMost that when True makes the window always in front of anything else in the desktop (like dialog messages). I'd to know if there is a opposite property in GTK+, in that when activated would make the window stay in the back of every thing on the desktop.
There's a line between the window manager's capabilities and what a UI toolkit can do. The toolkit takes care of the window's content, the window manager determines the placement and layering of windows. Such property is likely to be non-existent. It is potentially not feasible to implement the desired property across platforms (WMs) in a meaningful way.
Furthermore Gtk.WindowType only suggests only POPUP and TOPLEVEL.
Are you looking for a Gtk.StatusIcon for selectively showing and hiding your application window?

Wicket: Form in a modal window

I have written an panel which supports file / image uploads. So the panel is a simple plain form. The panel works in a normal Wicket page.
What I would like to do now:
I would like to use the panel in a modal window. The panel is displayed correctly. However, when I submit it / upload a new file, my browser prompts whether or not I would like to leave the page. The page which contains the DIV of the modal window is a form itself.
My research didn't turn up any interesting information about forms in a modal window expect it has to be self contained (nested form). I think this prerequisit is met.
Is there any information available, what I have done wrong? Any tutorials?
You need to use an AjaxSubmitButton (or AjaxSubmitLink) to submit your form. The problem is that the modal window requires Ajax communication. If you use the window to just reprocess a whole page and don't care about the Ajax'ness, then you can override the ModalWindow#getCloseJavaScript() method.
As Martijn pointed out, the modal window relies on AJAX communication. So use AjaxSubmitButton or equivalents. When components in the main window need to be updated after the submit of the modal window, this can be done by adding them to the AjaxRequestTarget.
However when it comes to multi part forms (file uploads) this does not work quite. Apparently multi part doesn't play nicely with AJAX. One has to do an IFrame trick as pointed out e.g. here: http://www.dooriented.com/blog/2008/04/23/wicket-ajax-like-file-upload-on-a-modal-window/

ActiveX Print a web page

I would like to find or write an Internet Explorer ActiveX control that will allow me to print a web page to a specific printer without a dialog box. The problem that I am having is that this particular page needs to print to a label printer with very specific orientation properties. Can anyone get me started? Thanks.
If you hook in to IE windows messages and wait for the print dialog to activate, using GetWindowText() to find the window with the "Print" title, you can send messages explicitly to the various controls to set the settings and click the "Print" button. This is much easier to do in IE7 than IE8, but with the help of SPY++ to find control IDs for each of the settings you can do it.
Why the requirement that you print without a dialog box? You can bring up the dialog box automatically with Javascript, and that way the user can choose the printer & options; otherwise you will have to hardcode the printer name. Ex:
<body onload="javascript:window.print();">
Perhaps you should probably consider outputting to something like a PDF or Word Document that is designed for that kind of specific layout - the HTML may render differently on various IE versions, and you probably don't want something as specific as labels to be messed up.
I have done it and its easy but I just can't seem to get my ActiveX control to register...
When I register is manually it works, but when I run it by itself, it fails.
ALl you need to do is create a form that which has got a WebBrowser control on it. Pass the page you want to view to the NavigateURL property and call the Navigate method.
After the navigation has been completed, you can call the print method. Since you a printing to a label printer, just remember to set the page margings and remove the header and footer and set it back again when the page has finished printing.
(I did my work in .Net)