Quantcast
Channel: Sandstorm's Blog (Home of ssUltimate Library)
Viewing all articles
Browse latest Browse all 160

xBox (a Textbox Control class)

$
0
0
Release 2

Here is 2nd Release of this class.

What's new:

- Added a protected property named Release just for the sole purpose of differentiating between releases (if any more release will happen in the future)

- Added Caption property.  This is what gets shown inside the box when there is no value



















- Added markers 3 & 4 which are magnifying glasses









- Added Icon property so any of you can customize the marker.  This icon image will be prioritized by the class over the default marker, if any.  If an image to be used as marker is included in the project, then you do not need to include fullpath.  If it is not, you need to include fullpath






- Moved the hover effect from within the textbox object to the class itself.  I was thinking of creating another property to optionally disable this hover effect should the user do not want it.  But then I realized all you need to do to disable this is to ensure that BorderEnter and BorderLeave are of the same RGB().

- Added KeyPress Event

Here is the download link for this class and the dermo form:
https://dl.dropboxusercontent.com/u/15025358/xbox_demo.rar
=====

Release 1

What is xBox?  This is a textbox with curvature effect which is a descendant of ssTextBox container class for my ssUltimate library.  Basically, this class is cleaner since I now use a control class type here as against a container class for ssTextBox.

Actually, I decided to create this new control class yesterday because of a post I saw inside Foxite about a textbox with auto-complete.  So I fooled around with codes but before being able to post a way, I found out that our good friend Vilhelm-Ion Praisach has already beaten me in posting there how it can be done.  :)

Another reason why I decided to work on this new class is because I saw that it will be faster for users of my ERP app to have something like that auto-complete instead of using a combobox.  And thus, this new class is born.

Why, you may say, instead of enhancing the old ssTextbox, I created this new one?  Because I am not overly satisfied with that old one being I designed it as a container class before.  Control classes are cleaner in a sense that objects inside won't be shown in the form.  Here are images comparing a container class and a control class when inside a form:

Container Class


 Control Class


However, its strength is also its weakness in the sense that you won't be able to directly reach the objects of the control class from within the instance of the class inside a form as those are somewhat hidden.  For reaching a control class, the developer has to create properties and methods in the class itself; which is what we have here (see new features).

Forwarded Features from ssTextBox:

  • Curvature
  • Marker (check marks)
  • Others (I forgot, just check my blog entry for that)

    New features:
    • As mentioned, being a control class type then it is cleaner
    • Added hover effect on border with curvature (although if you have my latest ssClasses as well I shared recently inside Foxite, then this is now also included there).  This is affected by .BorderEnter and .BorderLeave properties of the class, the values you need to put there are RGB() of your taste.
    • AutoComplete Feature (Optional) - If you wanted this class to perform an auto-complete, then you should use these two properties:
      • AutoCompSource - is the record source (cursor or table) subject to seeking
      • AutoCompField - is the fieldname of the recordsource where search would be performed by the class


    The class takes advantage of a structural index tag of the same name as the AutoCompField, if there is, and will use SEEK().  If the table does not have that necessary index tag, then it will switch to using LOCATE.

    • Since my goal in creating this new class is to replace some of my comboboxes for faster searching, then I have to have the Combobox' ability to return two possible values at a time.  But it is comparably easier though to return any values from any fields of the AutoCompSource with xBox via the ExtraField and ExtraValue properties. 
    Shown below is the comparison between a combobox and xBox:
      ComboboxxBox
      DisplayValueValue
      ValueExtraValue
      How come I have not swapped the above?  That is because in combobox, no matter where you get the value, what will be shown on the object is always the DisplayValue.  So in the case of xBox, that is the same.  
      In combobox, value can come from any column, be it visible or not (see http://sandstorm36.blogspot.com/2012/08/combobox-tricks-part-i.html).  In xBox, ExtraValue then is the same, it can come from any other field aside from the field being displayed (Value).  This ExtraValue is dependent on the  ExtraField property of the class (see demo project).  
      • When AutoComplete feature is used, then when a match is found, it is shown on the current forecolor we set.  When a match is not found, then forecolor turns into red as an added visual indicator









      • Right-click context (just usual stuff like cut, copy, paste, select all, Clear, Undo/Redo last action; maybe I will add more in the future)
      • InteractiveChange Event is added
      • Basic properties like FontSize, FontName, ForeColor, Format, and InputMask are added.  Will add others soon but for now, those are what I basically need

      I hope that you will find this useful on your end as well.  I welcome suggestions to improve this further.  Like I said, this is created only yesterday and I have added features based only on what I need right now.  For my subscribers, then this will be part of ssUltimate library.  I will update you all soon.

      Cheers!

      Viewing all articles
      Browse latest Browse all 160

      Trending Articles