;how do you haddle OnAplly() for many property sheets [modified]
-
hi since when Apply is clicked in a property sheet, its OnAplly() calls updateData() for the active page and initializes an ELLPROP structure with the settings, then sends a message to the main window containing the structures address.The main Window forwads the massage to the view (so far so good),the view copies the property values to its own data members (comes the problem) -suppopse i have many property sheets,each one will have an OnApply() that will fill the ELLPROP Structure with its own values, the mainframe will handle OnApply Once like this LRESULT CMainFrame::OnAplly(WPARAM wParam,LPARAM lParam) { m_wndView.SendMessage(WM_USER_APPLY,wParam,lParam); return 0; } then the view also will handle it once ..view::OnAplly(WPARAM wParam,LPARAM lParam) { ELLPROP* pep = (ELLPROP*)lParam; // my question what do i do here (if am supposed to do it only here) if i have multiple property sheets // :confused:lemmi give an example i may think of using proprty sheets insead of very many dialog boxes to write a simple school management program. so one property sheet be for registration (first page studets reg, 2nd page staff reg,3rd page, members reg ..), another property sheet will be for finance (1st page setting the fees charges,2nd page payment of fees, 3rd page payment os salaries and wages to workers, 4th page payment of bills ..) know i want each to update a database using ADO so each property page will have to open an appropriate recordset and do that(i havent tried the database part and know whether it will bring problems too),what i have tried is to have all the input values sent to the view so that i can display them in the client area and i dont know how the view's member variables will copy all these values that are coming from different property sheets and each sending an ELLPROP structure..(should i have some kind of control to know that this structure is from the finance sheet so just copy the finance deatils and leave the registration details- and if so how do i control that) ....... ..... } am new to MFC (4 mths know) so please if you can give me more deatils i'll rilly appreciate,thanks.:laugh: i h -- modified at 2:28 Monday 13th August, 2007
-
hi since when Apply is clicked in a property sheet, its OnAplly() calls updateData() for the active page and initializes an ELLPROP structure with the settings, then sends a message to the main window containing the structures address.The main Window forwads the massage to the view (so far so good),the view copies the property values to its own data members (comes the problem) -suppopse i have many property sheets,each one will have an OnApply() that will fill the ELLPROP Structure with its own values, the mainframe will handle OnApply Once like this LRESULT CMainFrame::OnAplly(WPARAM wParam,LPARAM lParam) { m_wndView.SendMessage(WM_USER_APPLY,wParam,lParam); return 0; } then the view also will handle it once ..view::OnAplly(WPARAM wParam,LPARAM lParam) { ELLPROP* pep = (ELLPROP*)lParam; // my question what do i do here (if am supposed to do it only here) if i have multiple property sheets // :confused:lemmi give an example i may think of using proprty sheets insead of very many dialog boxes to write a simple school management program. so one property sheet be for registration (first page studets reg, 2nd page staff reg,3rd page, members reg ..), another property sheet will be for finance (1st page setting the fees charges,2nd page payment of fees, 3rd page payment os salaries and wages to workers, 4th page payment of bills ..) know i want each to update a database using ADO so each property page will have to open an appropriate recordset and do that(i havent tried the database part and know whether it will bring problems too),what i have tried is to have all the input values sent to the view so that i can display them in the client area and i dont know how the view's member variables will copy all these values that are coming from different property sheets and each sending an ELLPROP structure..(should i have some kind of control to know that this structure is from the finance sheet so just copy the finance deatils and leave the registration details- and if so how do i control that) ....... ..... } am new to MFC (4 mths know) so please if you can give me more deatils i'll rilly appreciate,thanks.:laugh: i h -- modified at 2:28 Monday 13th August, 2007
Can you reword the question, to others understanding ?
Prasad MS MVP - VC++
-
hi since when Apply is clicked in a property sheet, its OnAplly() calls updateData() for the active page and initializes an ELLPROP structure with the settings, then sends a message to the main window containing the structures address.The main Window forwads the massage to the view (so far so good),the view copies the property values to its own data members (comes the problem) -suppopse i have many property sheets,each one will have an OnApply() that will fill the ELLPROP Structure with its own values, the mainframe will handle OnApply Once like this LRESULT CMainFrame::OnAplly(WPARAM wParam,LPARAM lParam) { m_wndView.SendMessage(WM_USER_APPLY,wParam,lParam); return 0; } then the view also will handle it once ..view::OnAplly(WPARAM wParam,LPARAM lParam) { ELLPROP* pep = (ELLPROP*)lParam; // my question what do i do here (if am supposed to do it only here) if i have multiple property sheets // :confused:lemmi give an example i may think of using proprty sheets insead of very many dialog boxes to write a simple school management program. so one property sheet be for registration (first page studets reg, 2nd page staff reg,3rd page, members reg ..), another property sheet will be for finance (1st page setting the fees charges,2nd page payment of fees, 3rd page payment os salaries and wages to workers, 4th page payment of bills ..) know i want each to update a database using ADO so each property page will have to open an appropriate recordset and do that(i havent tried the database part and know whether it will bring problems too),what i have tried is to have all the input values sent to the view so that i can display them in the client area and i dont know how the view's member variables will copy all these values that are coming from different property sheets and each sending an ELLPROP structure..(should i have some kind of control to know that this structure is from the finance sheet so just copy the finance deatils and leave the registration details- and if so how do i control that) ....... ..... } am new to MFC (4 mths know) so please if you can give me more deatils i'll rilly appreciate,thanks.:laugh: i h -- modified at 2:28 Monday 13th August, 2007
king`ori wrote:
each property page will have to open an appropriate recordset
This is a flaw in your design: The document should hold the connection to the database, and the views (a property sheet is a view) access the property sheet. This holds true even if your application does not use MFC Doc/View. This paradigma is called model/view/controller and is independent of the toolkit used. You just might have to code more yourself.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
George Orwell, "Keep the Aspidistra Flying", Opening words