For many days I am trying to figure out how to show employees on vertical columns for EventKit Calendar. I have tried all the available demos on Github and SO.
"I WANT TO DISPLAY EMPLOYEES NAMES, instead of Date Time on top"
I want to display like this:
and currently I have
I have been working on
RVCalendarWeekView
CalendarKIT
And this is my code for objective c, you can guide me for the case of SWIFT ASWELL
- (void)setupWeekData{
self.decoratedWeekView = [MSWeekViewDecoratorFactory make:self.weekView
features:(MSDragableEventFeature)
andDelegate:self];
///*MSDragableEventFeature |*/ MSChangeDurationAndDragableFeature | MSNewEventFeature | MSInfiniteFeature | MSPinchableFeature |MSShortPressNewEventFeature /*| MSChangeDurationFeature*/
//Optional, set minutes precision for drag and new event (by default it is already set to 5)
[MSWeekViewDecoratorFactory setMinutesPrecisionToAllDecorators:self.decoratedWeekView minutesPrecision:5];
//Create the events
MSEvent* event1 = [MSEvent make:NSDate.now
title:#"Title"
subtitle:#"Central perk"];
MSEvent* event2 = [MSEvent make:[NSDate.now addMinutes:10]
duration:60*3
title:#"Title 2"
subtitle:#"Central perk"];
MSEvent* event3 = [MSEvent make:[NSDate.tomorrow addMinutes:10]
duration:60*26
title:#"Title 3"
subtitle:#"Central perk"];
MSEvent* event4 = [MSEvent make:[NSDate.nextWeek addHours:7]
duration:60*3
title:#"Title 4"
subtitle:#"Central perk"];
_weekView.delegate = self;
_weekView.weekFlowLayout.show24Hours = YES;
_weekView.weekFlowLayout.hourGridDivisionValue = MSHourGridDivision_15_Minutes;
// if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// _weekView.daysToShowOnScreen = 7;
// }
// else{
// _weekView.daysToShowOnScreen = 2;
// }
_weekView.daysToShowOnScreen = 1;
_weekView.daysToShow = 30;
_weekView.weekFlowLayout.hourHeight = 50;
_weekView.events = #[event1,event2,event3,event4];
}
Related
I am using EventKit to fetch all events from the default Apple Calendar in my app.
When there is a custom recurring event in the Apple Calendar with multiple days of recurrence then EventKit returns an array of daysOfTheWeek in the recurrence rule
What I mean is Event_A is recurring weekly every Friday and Saturday then EventKit returns an array of objects like this
calendar = "testingcurvecalendar#gmail.com";
endDate = "2022-07-30 11:00:00";
id = "5FFF5521-18BB-497C-8EF5-4E72647A6A24:2AE552B8-85C4-489C-8A36-DACF95D83E61";
lastModifiedDate = "2022-05-20 10:25:01";
rrule = {
calendar = gregorian;
daysOfTheWeek = (
{
dayOfTheWeek = Friday;
weekNumber = 0;
},
{
dayOfTheWeek = Saturday;
weekNumber = 0;
}
);
freq = weekly;
interval = 1;
until = {
count = 0;
date = "2022-07-31 23:59:59";
};
};
startDate = "2022-07-30 10:00:00";
title = MultipledayswithEnd;
},
But if an event is recurring for only single day then eventkit
does not return daysOfTheWeek object
i.e. Event_B is recurring weekly every Monday then the object received from the eventkit is as follows
calendar = "testingcurvecalendar#gmail.com";
endDate = "2022-07-27 11:00:00";
id = "5FFF5521-18BB-497C-8EF5-4E72647A6A24:C57AFD95-75A0-4F75-B4F0-00D7321BFB21";
lastModifiedDate = "2022-05-20 10:27:23";
rrule = {
calendar = gregorian;
freq = weekly;
interval = 1;
until = {
count = 0;
date = "2022-07-31 23:59:59";
};
};
startDate = "2022-07-27 10:00:00";
title = Singlewithend;
},
The issue is I would like to display the day of recurrence in my app which I am able to in case of Multi-day recurring events because I receive the days in dayOfTheWeek object but I cannot do it in Single-day recurring events.
The code for fetching events from the Calendar is as follows
NSPredicate *fetchCalendarEvents = [eventStore predicateForEventsWithStartDate:[NSDate date] endDate:endDate calendars:calendarArray];
NSArray *matchingEvents = [eventStore eventsMatchingPredicate:fetchCalendarEvents];
NSMutableArray * eventsDataArray = [self eventsToDataArray:matchingEvents];
Can someone please help me with this issue?
I'm working on ListView with pure win32 api. But when I set ListView with tile view. then the sub item does not appear beside item.
My code below:
ListView_SetView(m_hwndListview,LV_VIEW_TILE);
//Set tile view info
SIZE size = { 150, 75 };
LVTILEVIEWINFO tileViewInfo = {0};
tileViewInfo.cbSize = sizeof(tileViewInfo);
tileViewInfo.dwFlags = LVTVIF_FIXEDSIZE;
tileViewInfo.dwMask = LVTVIM_COLUMNS | LVTVIM_TILESIZE;
tileViewInfo.cLines = 3;
tileViewInfo.sizeTile = size;
//Set tile info
LVTILEINFO lvti = {0};
int order[2];
order[0]=2;
order[1]=1;
lvti.cbSize = sizeof(LVTILEINFO);
lvti.iItem = 0;
lvti.cColumns = 2;
lvti.piColFmt = LVCFMT_LEFT;
lvti.puColumns = PUINT(order);
ListView_SetTileInfo(m_hwndListview, &lvti);
ListView_SetTileViewInfo(m_hwndListview, &tileViewInfo);
Does anyone have idea to solve this problem?
Thanks so much!
lvti.piColFmt should be a pointer to an array of column format values, not a single value. In your case it could be something like this:
int colfmt[2];
colfmt[0] = LVCFMT_LEFT;
colfmt[1] = LVCFMT_LEFT;
lvti.piColFmt = colfmt;
Hope that helps!
I am very new to programming in Objective C (as in a few days), and unfortunately have an iPhone app due as a project for a class in a few days (in retrospect I probably should have chosen something different). One of the main features my app needs is the ability to select a dish from a menu by first selecting the meal on one page, and then the category on the next page, and then the dish on the final page. I have gotten my app to download a JSON file from an internet API and store it as an NSArray variable, but now I need to use that array to populate my tableview. Below is a sample from the downloaded array from my app's debug window. I already have the basic framework of the app (i.e. several different views) in place. This came from a sample app that populates the tableview rows with data from a plist file, but I want to use this JSON data. How would I use this array to populate the rows with the JSON data stored in this NSArray variable?
Thanks!
2012-12-05 03:29:48.973 MLBMobile[3858:c07] {
category = "BREAKFAST MEATS";
date = "2012-12-05";
meal = BREAKFAST;
name = "Low-Sodium Ham";
portion = 1;
recipe = 319044;
unit = oz;
}
2012-12-05 03:29:48.975 MLBMobile[3858:c07] {
category = "BREAKFAST MEATS";
date = "2012-12-05";
meal = BREAKFAST;
name = "Roasted Low-Sodium Turkey";
portion = 4;
recipe = 113503;
unit = oz;
}
2012-12-05 03:29:48.976 MLBMobile[3858:c07] {
category = "BREAKFAST ENTREES";
date = "2012-12-05";
meal = BREAKFAST;
name = "Cheddar Cheese";
portion = 1;
recipe = 130029;
unit = oz;
}
2012-12-05 03:29:48.976 MLBMobile[3858:c07] {
category = "BREAKFAST ENTREES";
date = "2012-12-05";
meal = BREAKFAST;
name = "Hard Cooked Eggs - Cage Free";
portion = 1;
recipe = 061009;
unit = each;
}
With your array variable you can iterate through each element. Use fast enumeration:
for(NSDictionary *dict in yourArrayVariable){
NSString *category = [dict objectForKey:#"name"];
//...you get the point
}
Now you can populate your row by just setting the properties of the row. For example, if you are using the default UITableViewCell:
cell.textLabel.text = name;
There is a bit more to this that you can do for better data/model/view separation, but I have just included examples as if it were all done locally in one file.
I'm trying to use a GWT 2.5rc1 custom tablebuilder to render a subtable for each row in my datagrid. I've followed the example in the 2.5 rc1 showcase (url: http://showcase2.jlabanca-testing.appspot.com/#!CwCustomDataGrid).
I'm able to see the newly added sub-rows, but the problem comes when I want to add a clickhandler to a subrow anchor element.. the clickhandler is never invoked, which it seems also quite clear to me since I'm not "registering" the event handler anywhere.
Here the code I'm using now, "relevant part":
private void buildRegRow(Registrazione rowValue,final int absRowIndex, boolean isCommentRow) {
// Calculate the row styles.
SelectionModel<? super Registrazione> selectionModel = cellTable.getSelectionModel();
boolean isSelected =
(selectionModel == null || rowValue == null) ? false : selectionModel
.isSelected(rowValue);
boolean isEven = absRowIndex % 2 == 0;
StringBuilder trClasses = new StringBuilder(rowStyle);
if (isSelected) {
trClasses.append(selectedRowStyle);
}
// Calculate the cell styles.
String cellStyles = cellStyle;
if (isSelected) {
cellStyles += selectedCellStyle;
}
if(isCommentRow)
cellStyles += childCell;
TableRowBuilder row = startRow();
row.className(trClasses.toString());
/*
* Checkbox column.
*
* This table will uses a checkbox column for selection. Alternatively,
* you can call dataGrid.setSelectionEnabled(true) to enable mouse
* selection.
*/
TableCellBuilder td = row.startTD();
td.className(cellStyles);
td.style().outlineStyle(OutlineStyle.NONE).endStyle();
if (!isCommentRow) {
renderCell(td, createContext(0), cellTable.getColumn(0), rowValue);
}
td.endTD();
/*
* View children column.
*
* Displays a link to "show children". When clicked, the list of friends is
* displayed below the contact.
*/
td = row.startTD();
td.className(cellStyles);
if(!isCommentRow) {
td.style().outlineStyle(OutlineStyle.NONE).endStyle();
if(rowValue.hasComments())
//td.className(CellTableResource.INSTANCE.dataGridStyle().showChildren());
renderCell(td, createContext(1), cellTable.getColumn(1), rowValue);
} else {
td.colSpan(getColumns().size() - 1);
// // Draw sub-table header
TableBuilder subTable = td.startTable();
TableSectionBuilder subTableSection = subTable.startTHead();
TableRowBuilder tr2 = subTableSection.startTR();
TableCellBuilder td2 = tr2.startTH();
td2.text(msgs.date());
tr2.endTH();
td2 = tr2.startTH();
td2.text(msgs.username());
tr2.endTH();
td2 = tr2.startTH();
td2.text(msgs.comment());
tr2.endTH();
td2 = tr2.startTH();
td2.text(msgs.actions());
tr2.endTH();
subTableSection.endTR();
subTable.endTHead();
subTableSection = subTable.startTBody();
for(final EntityComment ec : rowValue.getCommentList()) {
tr2 = subTableSection.startTR();
// Date
td2 = tr2.startTD();
td2.text(DateUtil.getDefaultDateTimeFormat().format(ec.getCreationDate()));
tr2.endTD();
// Username
td2 = tr2.startTD();
td2.text(ec.getUsername());
tr2.endTD();
// Text
td2 = tr2.startTD();
td2.text(ec.getText());
tr2.endTD();
// Actions
td2 = tr2.startTD();
// Remove
Anchor removeAnchor = new Anchor("remove");
removeAnchor.addClickHandler(new ClickHandler() {
#Override
public void onClick(ClickEvent event) {
Window.alert("clicked");
}
});
td2.html(new SafeHtmlBuilder().appendHtmlConstant(removeAnchor.toString()).toSafeHtml());
tr2.endTD();
subTableSection.endTR();
}
subTable.endTBody();
td.endTable();
}
td.endTD();
for(int i = 2; i <= 6; i++) {
// Recorded, list name, callcenter, msisdn
td = row.startTD();
td.className(cellStyles);
td.style().outlineStyle(OutlineStyle.NONE).endStyle();
if(!isCommentRow) {
renderCell(td, createContext(i), cellTable.getColumn(i), rowValue);
}
td.endTD();
}
row.endTR();
}
The subtable shows up, with an anchor at the correct position, but the clickhandler is never invoked. I do not know how to write the handler code to the page, like I've done to render the anchor.
Thanks for any help.
I have tried custom tablebuilder and created a grid. You can add any element using the proper structure. Make sure you set the Unique Id to each element you create. Then through code access the element through the following code,
Element e = DOM.getElementById( id );
Cast the element to its proper widget i.e, if you are using text input element you can always cast it to textbox. To cast the element there is one more step which you can google out. Then add the clickhandler or whichever handler you want.
I'm trying to build the relationships for an object. But I guess I'm not understanding everything properly. When I set them, it looks like they all get set properly (that is, the relationships are found). But when I loop over them later, some of them (not all) don't exist.
I have an Report, which has many LineItems. Each inspection item one Rating. When I create an inspection, I'm copying data from another object, ReportMaster. ReportMaster also has MasterLineItems which also have Ratings. But as of right now I can't guarantee that the relationship between MasterLineItems and Ratings is correct. Therefore when I copy the ReportMaster's attributes for the Report I also do a fetch for the Rating.
I have a method within Report to check to see if all the LineItems have Ratings. But I can never get it to return true.
My question is, how should I properly be setting these attributes, or what am I doing wrong? Thanks. (The relationship building as at the end of the code block)
# Creating Report
Report *report = [Report object];
[report setWithMasterReport:masterReport];
# Report.m
- (void)setWithMasterReport:(MasterReport *)masterReport {
self.name = [masterReport.name copy];
[self addLineItems:[LineItems copyItemsFromMasterReportItems:masterReport.masterLineItems]];
NSLog(#"items have ratings: %i",[self lineItemsHaveRatings]);
}
- (BOOL)lineItemsHaveRatings {
NSArray *lineItems = [[self lineItems] allObjects];
BOOL t = TRUE;
for (LineItem *lineItem in lineItems){
if (lineItem.rating)
t = t && TRUE;
else
t = FALSE;
}
return t;
}
# LineItem.m
+ (NSSet*)copyItemsFromMasterReportItems:(NSSet *)masterLineitems {
NSMutableArray *lineItems = [NSMutableArray arrayWithArray:[masterLineitems allObjects]];
// go through one by one and replace inspectionFormItem with the inspectionItem copy
for (NSUInteger i; i < [lineItems count]; i++){
LineItem *lineItem = [InspectionItem object];
[lineItem setWithMasterLineItem:[lineItems objectAtIndex:i]];
[lineItems replaceObjectAtIndex:i withObject:lineItem];
}
return [NSSet setWithArray:lineItems];
}
- (void)setWithMasterLineItem:(MasterLineItem *)masterLineItem {
self.name = masterLineItem.name;
self.ratingID = masterLineItem.ratingID;
Rating *rating = [Rating findFirstByAttribute:#"myID" withValue:self.ratingID];
if (rating)
[self setRating:rating];
}
When I run that I get
items have ratings: 0
Another part of this question is, in these "init" methods (setWith...:) should I be copying the attribute or not? If so, should I be copying the relationship too? I just want a pointer to the object, right?
Side note: these are CoreData objects and I'm using RestKit which is why I get the findFirstByAttribute:withValue: helper method.
Thanks for any help.
Update
- (BOOL)LineItemsHaveRatings {
NSArray *lineItems = [[self LineItems] allObjects];
BOOL t = TRUE;
for (LineItem *lineItem in lineItems){
if (lineItem.rating)
t = t && TRUE;
else {
t = FALSE;
Rating *rating = [Rating findFirstByAttribute:#"myID" withValue:LineItem.ratingID];
NSLog(#"[No Rating Found] %#",lineItem);
NSLog(#"[Rating to find] %#",rating);
}
}
return t;
}
[No Rating Found] <LineItem: 0x8200e40> (entity: LineItem; id: 0x8200d00 <x-coredata:///LineItem/t05319326-640E-4DA5-B619-EB20621E3D533> ; data: {
rating = nil;
ratingID = 13903;
})
[Rating to find] <Rating: 0xec356a0> (entity: Rating; id: 0xec31520 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/Rating/p15553> ; data: {
myID = 13903;
name = "APPA (Northwestern Memorial Hospital)";
rangeItemRatings = (
"0xec3a2d0 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/RangeItemRating/p2952>",
"0xec3a2b0 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/RangeItemRating/p2950>",
"0xec3a2e0 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/RangeItemRating/p2953>",
"0xec3a2f0 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/RangeItemRating/p2954>",
"0xec3a2c0 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/RangeItemRating/p2951>"
);
ratingType = "0xec368b0 <x-coredata://4EE6AD5A-CC34-460A-A97A-0909454126A4/RatingType/p112>";
ratingTypeID = 1;
})
It is strange to me that the other relationships are built and stayed connected. But this one doesn't. ... oh. I didn't have the relationship set to be a to-many relationship. Oops.
I just needed to changed the relationship type for the Rating.