Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - ReadOnly
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ReadOnly

 Post Reply Post Reply
Author
Message
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Topic: ReadOnly
    Posted: 29 March 2009 at 4:32am
How can I set ReadOnly mode ?
 
In some cases (like preview of appointments for customers taken automaticalli from database and build from custom recordset) I do not want the user to edit or add, just see and (eventually) print.
 
I've used bEnableInPlaceCreateEvent to prevent adding apps, but I don't know how to prevent moving, change or delete them.
 
TIA
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 03 April 2009 at 6:42pm
Edit event in the case of disable in-place editing possible only using Event Editor - call by Context Menu which app can control with own logic or mouse click - you can also disable with Advanced Options
Back to Top
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2009 at 1:55am
Sorry, I dont understand your answer.
 
I've already disabled all edit option available, but doubleclick still open the event detail, I can move, resize and drag&drop to another date..
 

It is possible to add a SetReadOnly() in future version (I've tested EnableWindow(FALSE) but many functions are not working ) ?

TIA.

VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2009 at 9:52am

Double click call Application event editor form (not part of control itself) - you can disable this call as other context-menu related call for your own read-only mode.

I think that we can add ReadOnly flag in future version - may be even on event level

Back to Top
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2009 at 10:14am
Double click open

CXTPCalendarOccurSeriesChooseDlg or CXTPCalendarEventPropertiesDlg

Can you please tell me how I can override this ?
 
 
TIA
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2009 at 10:27am
example - CalendarDemo MFC app - handler for context menu create and call internal dialog - but you can use your own dialog here

case ID_POPUP_PROPERTIES:

{

ASSERT(hitInfo.pViewEvent);

if (hitInfo.pViewEvent)

{

CXTPCalendarEvent* pEvent = hitInfo.pViewEvent->GetEvent();

CXTPCalendarEventPtr ptrEvent = pEvent->CloneEvent();

CXTPCalendarControl::CUpdateContext updateContext(&GetCalendarCtrl(), xtpCalendarUpdateLayout|xtpCalendarUpdateRedraw);

CXTPCalendarEventPropertiesDlg dlg(&GetCalendarCtrl(), FALSE, this, ptrEvent);

dlg.m_bOccurrence = TRUE;

dlg.DoModal();

}

}

 

BTW- I add public member of CXTPCalendarControl - BOOL m_bReadOnlyMode;

and property in ActiveX ReadOnlyMode user can get and set on app level
Back to Top
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2009 at 1:55pm

Thank you, meanwhile I've inserted:
CXTPNotifyConnection* ptrCalendarConn = m_ctrlCalendar.GetConnection();

ASSERT(ptrCalendarConn);
m_Sink.Advise(ptrCalendarConn, XTP_NC_CALENDARCONTEXTMENU, &CPlannerPreview::OnEvent_Calendar);
m_Sink.Advise(ptrCalendarConn, XTP_NC_CALENDARLBUTTONDBLCLICK, &CPlannerPreview::OnEvent_Calendar);
m_Sink.Advise(ptrCalendarConn, XTP_NC_CALENDARKEYDOWN, &CPlannerPreview::OnEvent_Calendar);
m_Sink.Advise(ptrCalendarConn, XTP_NC_CALENDAR_IS_EVENT_EDIT_OPERATION_DISABLED, &CPlannerPreview::OnEvent_IsEditActionDisabled);

in calendar (into dialog-derived class) init function

and

void CPlannerPreview::OnEvent_Calendar(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam)
{
 TRACE( "Do nothing: Event %ld - wParam %ld - lParam %ld\n", (long)Event, (long)wParam, (long)lParam);
}

void CPlannerPreview::OnEvent_IsEditActionDisabled(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM lParam)
{
 if ( XTP_NC_CALENDAR_IS_EVENT_EDIT_OPERATION_DISABLED != Event)
 {
  ASSERT(FALSE);
  return;
 }
 XTP_EVENT_EDIT_OPERATION_PARAMS* pOPparams = (XTP_EVENT_EDIT_OPERATION_PARAMS*)wParam;
 BOOL* pbCancel = (BOOL*)lParam;
 ASSERT(pbCancel);

 // check is already canceled/handled
 if ( !pOPparams || !pbCancel || *pbCancel)
 {
  return;
 }
 *pbCancel = TRUE;
}

So no action can be taken.

 
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2009 at 2:04pm
Right - I told you that you have enough already exited features to prevent non-needed actions
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.