Buttons, Inputfield and a table (kind of) RRS feed

  • General discussion

  • Hi,

    (programID QRT907)

    I wrote a small demo to see if buttons, inputfields and a table are possible. In about an hour it was done! The window is obviously redrawn to often. But it should not be too hard to make that better.

    If you want to add an extra object simply add lines like in the beginning of the programm (mind the index and that all fields are added).

    One big disadvantage: it does not work in Silver Light (And I have no idae how to fix that)

    kind regards,



    Saturday, April 3, 2010 9:04 AM

All replies

  • Strange enough the code does not work on my own website, but it does at http://www.smallbasic.com/program/?QRT907

    Unfortunatly the rectangles around a field of button do not appear.

    Sunday, April 4, 2010 4:26 PM
  • Looks interesting.  Maybe silverlight isn't working for you because of the fast redrawing (somehow).  You could try using persistent Shapes instead of redrawing lines and erasing screens?
    Sunday, April 4, 2010 4:37 PM
  • There are some issue with Silverlight conversion from SmallBasic, some around events and drawing graphics repeatedly (some not registering as you see).  There are several threads on this issue in this forum.  While these issues remain, your code works better for me using the ideas of using event flags in a main loop (Import QRT907-0).  This may not solve your issue, but it seems to help.  You can increase the Program.Delay() in the main While ("True") ... EndWhile loop to give Silverlight more time to catch up.

    You may also think a bit about the flicker from the GraphicsWindow.Clear() called on each mouse move - not a simple fix for this, rather probably only updating the bits of the screen required depending on what is happening - more complicated.

    A little more playing on the rectangles not appearing and I suggest doing the FillRectangle before DrawRectangle helps - it looks like the screen resolution scaling is not exactly scaled perfectly - also see the pixel positions are not integers (Import QRT907-3 or http://www.smallbasic.com/smallbasic.com/program/?QRT907-3 ).

    With a bit more playing and work you may get it working reasonably, but there is not a perfect 1to1 correspondence between what you get in SmallBasic and the Silverlight implementation - some care is needed testing both if you want to use it on a web site.

    PS, these cross platform differences is a common development issue with all languages, we just have to write the best code we can, then test and modify.

    Sunday, April 4, 2010 5:08 PM