Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ListView updating idiom (Read 3885 times)
DamianC
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Joined: Aug 19th, 2015
ListView updating idiom
Aug 31st, 2015 at 9:44am
Print Post  
Hi all,

I am struggling away trying to get a ListView working correctly. The aim is schedule work for a vehicle. In the header there is lots of information that lets the user know the scheduled workload so they can make good decisions on scheduling.

As they move the specified repair I am trying to get the calendar to update. The correct data is on the screen when the calendar is launched, however, I can't get updates to work.

I am catching an "ItemModified" event. All good. From that I run a "reloadData()" method that has the following pseudo code ...

<snip>
calendar.beginInit();
--- do the recalculations here ---
calendar.endInit();
calendar.update();
calendar.ensureVisible(myAppointment);
</snip>

I know this code is run at the correct time, but it does not do anything on the screen.

I can set a breakpoint - and when I release the breakpoint the screen updates - but the "ensureVisible(myAppointment)" jumps to the wrong area of the calendar.

Is there a correct "idiom" for updating the calendar?

Any suggestions would be most appreciated.

Many thanks,
-Damian
  

JPlannerListViewScheduler.jpg ( 49 KB | 148 Downloads )
JPlannerListViewScheduler.jpg
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ListView updating idiom
Reply #1 - Aug 31st, 2015 at 11:00am
Print Post  
Hi,

The BeginInit/EndInit block is a proper way to update the Calendar control. Do you have problems with visually updating certain areas of the control or only with the ensureVisible method? Keep in mind that the ensureVisible method can only be used to locate an item, which is already loaded in the control, that is, an item that can be scrolled to using the scroll bars. If the item is outside of the currently scrollable range, it cannot be located using ensureVisible.

Regards,
Meppy
  
Back to top
 
IP Logged
 
DamianC
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Joined: Aug 19th, 2015
Re: ListView updating idiom
Reply #2 - Sep 1st, 2015 at 11:07am
Print Post  
Hi Meppy,

Thanks for your reply.

I must say that I am pushing JPlanner pretty hard - but besides these few small issues - there have been no crashes or weird stuff. I am very impressed. It is a powerful and robust tool.

I have now got the updating working nicely - but I have stumbled across a few little issues. The updating problems were mainly my mistakes, but were also a few JPlanner issues.

1. My first issue is that the Item/Appointment seems to always report back the wrong end date. On the screenshot you can see that the Appointment goes from 1 Sept to 4 September inclusive. However, the ItemModifiedEvent returns 1 Sept to 5 Sept. The endDate is ALWAYS the day after shown on the screen. I have it printing out on the Appointment for clarification. Is this normal behavior?

2. How to set the font on the Appointment. I've tried a few different ways but I can't make anything work. eg no luck with calendar.getItemSettings().getSelectedItemStyle().setFont(MyFont);

3. Is there any way to programatically "un-select" Items? Our users can click on an item and get more information pop up. However, this action selects the item. That is sort of OK except that it causes some strange automatic scrolling behaviour if the mouse moves off the panel.

4. Grid lines disappear. When we set the color of for Saturday & Sunday it seems to go over the grid lines. How can we ensure the grid lines are visible? This is what we normally do ...
DayOfWeekStyle sun = new DayOfWeekStyle();
calendar.setDayOfWeek(DayOfWeek.Sunday);
calendar.getStyle().setBrush(new SolidBrush(Colors.LightCyan));
calendar.getDayOfWeekStyles().add(sun);

5. (More a comment than a question) A small issue is with calendar.ensureVisible(MyAppointment). It partially works - but it only ensures that "start date" is visible. I have worked around it by going ...
calendar.ensureVisible(DateTime.today());
calendar.ensureVisible(job.getEndTime().addDays(2));
calendar.ensureVisible(job.getStartTime());
This displays exactly what I want displayed 99% of the time.

Any thoughts much appreciated.

Again, many thanks for the great product and the excellent support.

Many thanks,
-Damian
« Last Edit: Sep 2nd, 2015 at 1:37am by DamianC »  

JPlannerAppointmentDate.jpg ( 96 KB | 122 Downloads )
JPlannerAppointmentDate.jpg
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: ListView updating idiom
Reply #3 - Sep 2nd, 2015 at 6:59am
Print Post  
Hello again,

1. This is the expected behavior. The appointment actually ends on Sep 5th at 0:00 o'clock and this is what is visually represented on the screen if you consider the time to be a continuum.

2. Keep in mind that getSelectedItemStyle() returns the style of the items when they are selected. You should also customize the style returned by getStyle() if you want to affect the unselected items as well.

3. Which event are you using to display the popup information? Usually the calendar starts dragging a clicked item until the mouse is released. To prevent this, try calling Calendar.resetDrag().

4. Try setting the border properties of the DayOfWeekStyle.getStyle() object. For example:

Code
Select All
sat.getStyle().setBorderLeftColor(...);
sat.getStyle().setBorderLeftWidth(...); 


5. We will check if we can fix this.

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint