Tuesday, April 20, 2004

As Neil and Peter had already mentioned, we are working on v1.1 of the SDF. One of the new controls that will be available in the new release is the SmartList. It is an owner-drawn list control that provides a much required functionality for creating applications for Smartphone platform. SmartList is derived from OwnerDrawnList and aside from all functionality that is already provided by ListBoxEx, implements a quick filtering functionality similar to the built-in Contacts application, auto numbering for creating a menus that you see on the start menu and overall drawing speed improvement.

4/20/2004 3:26:39 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Thursday, April 08, 2004

Alright, I am back from the MVP Summit and oh boy, it was FUN! Meeting the whole OpenNETCF.org gig and CF MVP's (some of them I've met in person for the first time - Peter, Casey, Dan Fergus, Tim Wilson etc...) was a real blast for me and probably the most valuable experience during this Summit.

4/8/2004 3:32:02 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Thursday, April 01, 2004

Due to lack of feedback and constant complaints from the developers we at OpenNETCF.org decided to close all source code we created and make it commercial offering with the price of $5000.00.

The source code will be removed from the web site at 6:00 PM EST.

4/1/2004 8:55:58 PM (GMT Daylight Time, UTC+01:00)  #     | 
 Tuesday, March 23, 2004

Just to prove in the hundred's time that there's nothing impossible exist for him, Alex Feinman has posted this article on OpenNETCF.org. It shows how to create a managed Icon object from native icon handle. Brilliant job (as always) Alex! 

3/23/2004 8:14:19 PM (GMT Standard Time, UTC+00:00)  #     | 

Brad is describing some new stuff coming with Whidbey for GC. Considering a much more memory constrained environment of CE devices, GC.AddMemoryPressure/GC.RemoveMemoryPressure and HandleCollector would be really nice to have for Compact Framework too!

3/23/2004 3:55:36 PM (GMT Standard Time, UTC+00:00)  #     | 
 Friday, March 19, 2004

I've finally released AtlasCE for SmartPhone 2003 which I think is one of the first commercial .NET CF programs for Smartphones. Aside from learning the intricacies of the smartphone UI, I had to create a key-press searching/filtering mechanism similar to the built-in Contacts application, a scrolling image viewer control with zooming functionality and other more interesting stuff. It was always like that for me - creating some program would lead to creation of a few “by-products” that could be utilized later on in some other applications. I'll try to show you how it's all been done in a later blog entries. Meanwhile I can tell you that I've used a lot of code from SDF: ListBoxEx, Configuraton and HTMLViewer.  

3/19/2004 8:28:03 PM (GMT Standard Time, UTC+00:00)  #     | 
 Thursday, March 18, 2004

Alright, so I've got this new and shiny blog now! Big thanks to Neil for spending his valuable time converting me to the dasBlogs. It has so much stuff that I will have to spend some time looking around.

Meanwhile, back to the subject.

In Windows programming there is a notion of Virtual ListBoxes or ListViews. It means that a list box would allow you to have unlimited amount of the displayed items. It is usually done by telling it how many items there should be and it simply delegates all drawing of items to the owner of the list box. Under Windows CE the list box can’t be made virtual, only a ListView. But it should be really easy to implement by utilizing OwnerDrawnList base control, which I described here and which has become a part of SDF.

So, here are the steps to implement the VirtualListBox:

 

  1. Derive from OwnerDrawnList to create a new class:

public class VirtualListBox : OwnerDrawnList

{

// Private members

      int count;

      private ArrayList itemList;

      // Constructor

      public VirtualListBox()

      {

            itemList = new ArrayList();

            this.ShowScrollbar= true;

      }

 

      // Property to the number of items

      public int Count

      {

            get

            {

                  return count;

            }

            set

            {

                  if (count!=value)

                  {

                        count = value;

                        itemList.Clear();

                        int[] items = new int[count];

                        itemList.AddRange(items);

                  }

            }

      }

 

      // if you don’t want to draw the item yourself just use this method

      public void DefaultDrawItem(DrawItemEventArgs e, String text)

      {

            Brush textBrush;

 

            Rectangle rcText = e.Bounds;

 

            //Add 3 pixels

            rcText.X += 3;

 

            if (e.State == DrawItemState.Selected) // selected                      {

                  e.DrawBackground();

                  textBrush = new SolidBrush(SystemColors.HighlightText);

            }

            else

            {

                  e.DrawBackground(this.BackColor);

                  textBrush = new SolidBrush(SystemColors.WindowText);

            }

 

// Draw the string

            e.Graphics.DrawString(text, this.Font, textBrush, rcText);

                 

            // Dispose the brush

            textBrush.Dispose();

 

      }

 

      // This is the required by base class override

      protected override System.Collections.IList BaseItems

      {

          get

          {

             return itemList;

          }

      }

           

       // This one required by base class too, but it will do nothing for us.

       protected override object BuildItemForRow(object row)

       {

             return null;

       }

 

   }

 

 

  1. Now we’re ready to use this control on the form. Add these lines to your form’s constructor:

 

InitializeComponent();

 

virtList = new VirtualListBox();

            virtList.Bounds = new Rectangle(1, 1, 200, 100);

            virtList.BackColor = Color.White;

            virtList.Count = 100;

            virtList.ItemHeight = 14;

           

            // Add the control to the form’s controls collection

            this.Controls.Add(virtList);

            // Let’s hook up into DrawItem event

         virtList.DrawItem+=new DrawItemEventHandler(virtList_DrawItem);

 

  1. Implement drawing event in your form:

private void virtList_DrawItem(object sender, DrawItemEventArgs e)

      {

        // You can draw the items yourself here or just delegate to the list itself.   

        virtList.DefaultDrawItem(e, "Virtual Item " + e.Index.ToString());

   }

 

 

3/18/2004 8:26:33 PM (GMT Standard Time, UTC+00:00)  #     | 
 Wednesday, March 17, 2004
Peter  has posted a new article on OpenNETCF.org about hosting Native windows controls. In order to achieve that he had to use some low level hacks by changing window style of the MessageWindow and I absolutely agree with Peter - we need WndProc and native handles in CF in the v2. And don't forget Graphics.FormHdc, Bitmap.GetHBitmap and Icon.FromHandle! Having a powerful framework is great, but it can't wrap ALL available native functionality, so Microsoft, please, give us ability to develop what's missing ourselves.
3/17/2004 4:45:37 PM (GMT Standard Time, UTC+00:00)  #     | 
 Tuesday, March 16, 2004
Sybase has announced Pocket PowerBuilder. They say that it's  "a new rapid application development tool that speeds the creation of mobile and wireless enterprise Pocket PC applications. "  So, do we have a valid competitor to VS.NET + CF on the horizon? Has anybody tried it?
3/16/2004 9:15:16 PM (GMT Standard Time, UTC+00:00)  #     |