My application disappears from the task bar as soon as I move away from the main form - windows

Below is my code for the clicking of a button on the main form.
procedure TfrmLoginSelect.btnStudentLoginClick(Sender: TObject);
var
FilePAthFile:TextFile;
begin
assignFile(filepathfile,FilePathLocation);
reset(filepathfile);
readln(filepathfile,FilePath);
closeFile(filepathfile);
frmLoginSelect.visible:=False;
frmStudentLogin.visible:=True;
end;
Whenever this is clicked, however, the Delphi application is removed from the task bar. What am I doing wrong and how do I prevent this?

The problem is here:
frmLoginSelect.Visible := False;
The frmLoginSelect form is the main form. That is defined to be the first form created by a call to Application.CreateForm. The main form is the form associated with the taskbar button. Taskbar buttons only show when their associated window is visible. By hiding the main form you are also hiding the taskbar button.
It's difficult to give advice on how to resolve this. We cannot see enough of your program to say for sure what the right solution is. It's likely that you don't want frmLoginSelect to be the main form. But I cannot tell which form should be the main form.
It looks like you have a series of login forms that have to be navigated before the real main form can be used. I would handle that by showing the main form at startup, but then show the login forms as modal dialogs. Only if the user succeeds in navigating through the login forms does the main form become usable. Of course, I'm speculating wildly on what your application is really doing.
My broad advice in this area is to call Application.CreateForm once and once only during the lifetime of your program. For all other form creation call the form's constructor. Remove global form variables. All this goes against what the IDE wants you to do. But the IDE was designed when Borland were luring VB devs to Delphi. Don't let that drive your code architecture.

Related

Does Form.hide allow code to continue "beyond" a Form.Show Modal in vb6?

I'm doing a Form.Show Modal to force code execution until the user closes the shown form.
This form gets shown over again, so I'm thinking I'll just HIDE it. This seems to work OK, but wanted to confirm.
So:
frmMessage.Show MODAL
user clicks OK and frmMessage.Hide
code continues
You can either close or hide the modal form to allow the calling code to continue executing. At some point before your application closes you should make sure you unload any hidden forms though. I've had issues in my application with the application not always shutting down correctly when forms are still loaded and hidden. Might just depend on what resources your hidden forms are using.

Display of object class in page frame for visual foxpro 6

I've bundle of control save in .vcx file but I need to activate it to display it when i switch to different activepage in pageframe.
Could anyone guide me how to code and which kinds of event should i make on page frame switch, click or whatelse UIENABLEEVENT.
Thanks.
First, you might want to click on Help -> Tour for site etiquette and start voting / checking your answers so people know what worked or not that help you and others with similar issues.
Now, back to you question... If you have a form with a pageframe, make sure you have the "Properties" sheet open, it helps to ensure which object you are actually working with until you get more familiar with the IDE.
Once you click on the pageframe control, if you right-click and then select "Edit", that will bring you to the individual PAGE level of the pageframe. Once the PAGE is the basis of the focus you can put any control on it from either the toolbar, or if your project is open and you expand your .VCX class library, you can grab any control and put in on the page.
If you have multiple pages, once you click on the alternate pages, you will see that the first page (or whatever page) is no longer visible and the new page is available for you.
The actual handling of the pages on the pageframe for clicking / focus is automatically handled for you unless you want to do something extra.

Ordering issue in modal window

I have a problem with a component that loads in to a modal window. I am using the Alpha User Points system and it has a component that gives you a full list of yous site's users. It also gives you the ability to order by username, by points etc. If I use it outside of modal window it works fine. If I use it in to modal window, ordering don't work!!! When I put my mouse over table's headers, outside of modal window gives this...javascript:tableOrdering('aup.referreid','asc','');In to modal window I see this...javascript:tableOrdering('aup.referreid','asc','');?ml=1 Using Firebug, I remove this ?ml=1 and it works into modal also!!! So the question is, why in to modal window gives this ?ml=1, what is this? And how will I remove it?
Well here is the answer... I use the Modalizer extension of nonumber.nl. I was loading my component through modalizer's modal box, this is why I had this issue. So, if anyone use Modalizer to popup components and have the same problem with me, just go to modalizer's Plugin Manager, find the option Convert Links inside Window and disable it!!! But, after this, if you want to add link in to modal window and you don't want to show-up the whole front page but only the component or what ever this is, you have to add at the end of the link this &ml=1.

Calling reports from forms without displaying the form

As the title says, I would like to call the reports from forms without actually displaying the form. I am very new to Oracle forms. I tried to do the following but it didn't work:
1)Inserted the code to call the reports in WHEN-NEW-FORM-INSTANCE trigger.
2)Removed the canvas so that the form won't be displayed.
But I got the error
RM-30173: Module contains no canvases
Is it possible to do this?. I am trying to display the report when a menu item in an oracle forms application is clicked which in turn would call the above form but directly displaying
the report instead of displaying an UI.
Update:
I am using Forms Builder 10.1.2.
As for why I don't want to do this directly in the menu(MMB), the menu doesn't have an option to attach a report and I've already got a working form that generates an report but the code to call the report is written in a button-pressed trigger.
In,
http://forums.oracle.com/forums/thread.jspa?threadID=1107427&tstart=45, I am trying to do what Andreas Weiden, suggested in that thread.
I think your problem may be in limiting your menu options to only opening forms.
For example, you could instead have the menu in your form execute a form trigger which would call the report. Or a web.show_document to the url for the Report.
What version of Forms are you on? It's been a while since I did much with Forms, but this may give you a start.
I am only familiar with Reports 6i, and it was simple to just run the report from the menu.
We created a menu item that was PL/SQL Command Type, dropped the code to run the report module in the Menu Item Code box, and all was good. I'd be surprised if you couldn't do something similar in 10g reports.
Move the code from the form's button into a procedure in a common library. Attach the library to the form and to the menu module. Call the procedure from both the form button as well as the menu.
I solved the problem by creating a blank canvas in the 'dummy form' as 'FRM-30173: Module contains no canvases' was returned when no canvas was found in the form.
The approach suggested by Andreas Weiden here: http://forums.oracle.com/forums/thread.jspa?threadID=1107427&tstart=45 works well.
You could have also just created the report and just call it behind the menu option but hiding the report parameter form and the report would automatically begin to generate. In the menu option just before you call the report name just set the report paramform to hide and destype to screen. This would have save the trouble of creating a blank canvas and maybe having to suppress error messages if any was thrown.

Dialog windows in MVC

I'd like to ask a general question about MVC and dialog windows. Although I'm not very experienced in MVC pattern I can say understand its principles. What I don't know is how to manage dialog windows using MVC. Let's have a look at the particular situation: I have a main View (Window) and the controller. In the main View a user now clicks on button or menu "Options." The Options window should be raised, of course, and display several choices for the user. But who's actually responsible for creating and showing the Options window? View sends the information to the controller that user clicked on "Options" button. But now what? Controller should create new Window by itself? I don't think so, it usually doesn't create any objects of type View. The View? I also don't think so, it cannot manage Options information from the Options window. Someone else, probably, but who... Can somebody explain me how this should work, please? My preferred programming language is C# but this is more about principles. Thank you.

Resources