1 (edited by doing.whatever.it.takes 2015-09-04 21:02:16)

Topic: multiple button shows multiple forms

I have a form with 3 'show record' buttons 1) Edit 2)Account 3)Lessons; when I double click on the grid (to show a record) it opens the first 'Edit' but when I close the 'Edit' form the next form shows (account) and on closing this form the next form shows (lessons).  I have tried using form1.close; on close of the 'Edit' form but this didn't work.  How can I set the focus to the 'Edit' button and not have the other 2 buttons activate when double clicking on the grid to show a record?

Post's attachments

Attachment icon multiplebutton.png 7.28 kb, 306 downloads since 2015-09-04 

Re: multiple button shows multiple forms

Hello doing.whatever.it.takes

Very amazing what's happen  with your three buttons.

With MVD, every button you use has a well-defined function :

Behin New, you have to call procedure NewRecord.
Behind Edit, you have to call procedure ShowRecord,
behind Delete, procedure DeleteRecord,
behind Account, procedure Report (or ReportSQL),
behind Find, procedure Search or SQL Query and so one.

All those procedures come from property Action (which drop all available actions into MVD).
Never they interfere with each other unless you have made a programming error.

Post your application so we can see what's wrong, we could help you

JB

Re: multiple button shows multiple forms

Hi Jean,  thanks for your reply.  The three buttons in question are all property "Show Record" my question is I only want 1 button to show the record on double click of the grid.  The other 2 buttons are for convenience to show records using different forms so using the mouse to click these is acceptable.

Re: multiple button shows multiple forms

Hello doing.whatever.it.takes

Well I think you have to redefine your buttons.

The two first on you your picture (New and Edit) speak for themselves.

NEW to create a new item ( -> Action NewRecod)
EDIT to display one item (-> Action ShowRecord). This one will be called after a double_click on the Grid.

For others, you will have to rethink their role in the application.
If you want they display records with differents forms, you should be used SQL queries to get what you want or simply use the action SEARCH if this is not overly complex.
With MVD it is it's pretty easy to get.

Post your project on forum and we will see how to help you .

JB

Re: multiple button shows multiple forms

doing.whatever.it.takes
Please attach your project (zip file without exe and dll)
I'll try to help you.

Dmitry.

Re: multiple button shows multiple forms

Thanks Dimitry
the form is frmStudentList
the button I need to open on double click of grid is Button3 (opens frmStudentNew)
the other buttons that open the other forms are Button4 and Button5
it seems that the other forms appear when form frmStudentNew is closed.

Post's attachments

Attachment icon 150821 working - Copy.zip 37.4 kb, 475 downloads since 2015-09-06 

Re: multiple button shows multiple forms

doing.whatever.it.takes

Just change action of buttons Button4 and Button5 to "Show Form"

Dmitry.

Re: multiple button shows multiple forms

thanks Dimitry, I changed the buttons to Show Form and then used the following script to gain the feature I want

procedure frmStudentList_Button5_OnClick (Sender: string; var Cancel: boolean);
var
       Value1: string;
begin
       Value1 := SQLExecute('SELECT fldStudentName FROM tblStudent WHERE id=' + IntToStr(frmStudentList.TableGrid1.dbItemID) );
       frmLessonLIST.edit1.text := Value1;
end;