Thursday, September 14, 2017

xBox via SQL Pass-Through and Stored Procedures

Since xBox was created while I am still working with pure VFP, the approach I did was designed to work only on VFP's native backend.  So to have something like this:

You have to put in its InteractiveChange Event codes like this:

Local lcSQL
Select vesselname,vesselid from Vessels
      where [MySearch] $ vesselname 
      order By
      into Cursor curVessel NOFILTER

Where [MySearch] will be automatically replaced by xBox class with whatever you have already typed.  And curvessel.VesselName is the value it will return, the one that will be held by its .Value property.  There is secondary value it can return after that via .ExtraValue property but that is another topic.  If you are already a subscriber or user of ssUltimate's xBox, then you already know about this.

Lately, I decided to use MariaDB and so to make xBox working there, I showed the way here:

But that requires two jumps as follows:

* Get data from MariaDB/MySQL
SQLExec(gomyapp.dbHandle,'Select vesselname,vesselid from Vessels order by vesselname','vessels')
* Use generated cursor on the class
Local lcSQL
Select vesselname,vesselid from Vessels
      where [MySearch] $ vesselname 
      order By
      into Cursor curVessel NOFILTER

Or you can reverse the process limiting the number of records of the  cursor generated from the other backend using WHERE clause on the SPT query instead of the one needed by xBox class.  

Today, I added two new direct calls to the other backend which will not require a 2nd jump anymore.  Two new class methods, 1st is for SQL Pass-Through query approach and another for Stored Procedure approach.  Let us see how the call is made on those two:

via _SPT() Method.  This expects parameters as follows:
Lparameters ndbHandle, cSQL, cCursor, vValue, vExtraValue

Tuesday, September 12, 2017

CtrlBox New Features

Brief History

Originally CtrlBox is intended solely as a slave of my TitleBarX class when I decided to experiment with shapes for the controls there (minimize, maximize/restore, and close).  Later I decided to create it as a master of its own (while still being used by TitleBarX).  So now, it can be dragged and dropped onto a form and that will replace your form's native titlebar.

New Features

  1. Now it auto hides the form's native titlebar
  2. Now it auto repositions itself onto top-right corner
  3. New built-in titlebar of its own.  I added this today as sometimes I wanted to make the form movable but still using this class.  For this new titlebar to appear, you have to set _WithBar = .T. (default is .F. or no titlebar).  This is affected further by the following:
    • Caption - the caption to be shown on the titlebar

Properties affecting Caption follow:

  • FontName = default is Calibri
  • FontSize = default is 12
  • FontBold = default is .T.
  • ForeColor = default is RGB(255,255,255)
  • Alignment = default is 2 (center).  I know some of you will love to have a caption in the middle
  • BarHeight = Default is 20.  The height of the titlebar. This also affects the caption height 

Friday, September 8, 2017

SpinnerX (New), FaderX (Enhancement) & Others

I was creating this before but got busy with simultaneous projects.  But since I wanted to give some more feature for FaderX as I need it, then I decided to utilize this now instead of VFP's Native Spinner object. Right now this SpinnerX is very young that it has not much features yet but enough to be used as replacement for VFP Native Spinner class if you want something unique.  Its current properties follow:

- Appearance - Right now it has 3 different look as shown below:

- Value = Is the initial value fo the spinner
- ValueLow = Is the lowest value it can accept
- ValueHigh = Is the highest value it can accept
- Interval = Is the value to increase up or down

As with the native spinners, you can hover your mouse on it and use the mouse scroll to scroll up or down, or click on the buttons, or enter on the textbox.

Tuesday, June 27, 2017

DropTime Class

June 30, 2017

When Fast is still not fast enough....

I was supposed to update my subscribers this week but then I am thinking DropTime class is still not fast enough.  I need to make it faster.  And so I discarded the original concept of the class and turned this into a real time picker where user can also type if they want.  So this is how it looks now:

This class now also respects SET HOUR and will adjust display based on that.  What is more, the dropdown section now includes both hours and minutes into one so it involves only three (3) clicks now, first on the dropdown icon, 2nd on the hour and 3rd on the minute (that is if you don't want to type straight into the textbox for it):

And again on dtPicker nLevel = 3

Well that is it for now!  Next update will give it the capability to be used inside a grid.  Cheers!


Over the years, I tried to find ways to speed up and provide a unique time picker for my users and subscribers.  And I ended up working on different classes for this need:

DropClock - is a time picker based on combobox.  It has Interval property (default is 1) that allows faster picking of the hour and minute portion.   If interval is say set to 5, then the values shown will be with interval of 5, i.e., 5,10,15,20.... But it still is not fast enough because user still has to scroll down on the combobox especially if Interval is on default 1.

Then I created ScrollTime class which is like on Android.  It works with mouse scroll where you position your mouse pointer above the hour and scroll up and down.  The same on minute.  But it still is not fast enough too, plus it eats space on form.

Finally I created TimerX which is what I used in dtPickerX class for its time needs.  This is based on spinners so user can either type or spin the values.  But then it still is not fast enough.

I need something that will really make my users and subscribers' lives easier.

Finally I thought of a new idea this morning and I started working on it.  And behold my latest class, DropTime class.

Monday, June 19, 2017

NavigatorX class

Updates June 21, 2017

Added Options button (red gear on the image below)

Default value is shown.  You can turn it off via setting NoOption property to .T. and this button will be hidden.  Useful in some cases where we want to restrict users to specific things only.  This Option button (right now) gives users on-the-ply capabilities to do any of these:

  • Change Interval - by default, the interval of skipping a record is one (1).  It can be set on the PEM, Others tab into greater number but then you will be stuck up on that fixed interval.  So I decided to give users the capability to change skipping of number of records at their whim, and so this.
  • Jump To Record - is requested by a subscriber after I updated them yesterday.  This allows you to specify the record number to jump stright into that.
  • Set Filter (available only when bound to Grid) - allows you to filter grid records on-the-ply. 
  • Remove Filter (available only when bound to Grid) - as the name implies, remove the filter that you set above.
After posting this, I continued on testing the class and I made further changes to the Filtering Capability as follows:

It now forces you to click on a target column first before it allows filtering. If you haven't, it will give you the message 'Click on a Column First' which cannot be selected too.

That is because it has to know on which column of the grid it should perform the filtering.  After clicking on a header, then that is the time it will show the filtering capability and mentioning as well the target field like this:

In the above image, I clicked on the header of column for Company.  Please note that when it says Set Filter to Company, that company there is the underlying field used by that column and not the column header's caption.  That allows the users to realize too where they are performing the filter.

However, I remember that not in all cases, a filtering feature is good because there might be cases where there is already a filtering implemented in a grid and if we use this class filtering capability, then it can overwrite the filter condition which you guys set by codes.  And so for cases like that, I added the NoFilter property.  Set this to .T.  and it will not show that filtering capability anymore.

Miscellaneous Effects

Miscellaneous effects for GUI can be done via playing with these properties:

1.  BackColor, BackStyle, SpecialEffect, BorderColor, and BorderWidth.

2. Hover Effect.  Cousin Glen suggested an idea to show the border of the class on Mouse Enter.  I like it so I added it here as well.  To make the effect look better (at least to my taste), I changed SpecialEffect to zero as default.  So now when you move your mouse on top of the class, it is suddenly raised and when you move away from it, it goes back flat and borderless.

Some more ideas may come to me in the future about this class or some may be suggested by others.  We will see.

NavigatorX is a new control class that handles record navigation like going to top, previous record, next record, and going to last record or bottom.  I was browsing for some things on the web when I saw again a Paginator (Page 4 of 24) and I said to myself, well this looks cool to be added to ssUltimate Library?  But since we are not dealing with pages inside VFP as we have grid, then it is best known to us as a navigator.

Saturday, June 10, 2017

Breaking down Grid's Column object

A foxite member has sought assistance on how to make an active cell of a specific column change color, as additional visual highlight, upon receiving focus.  Of course it means AllowCellSelection is .T. to allow that specific cell focus.  So I showed him how via a sample code whereby I manipulated both GotFocus() and LostFocus() of the text object for that column to change the backcolor when it receives focus and to return it back to white on LostFocus.

I said new findings because a fellow respected member of Foxite, Tony Vignone, has mentioned on a comment under mine  that lostfocus is not needed on my sample codes as it achieves that switching of backcolor even without it (lostfocus codes I have shown) though he is not clear as to the whys.  So he asked me if I have an idea as to the whys.

And yes, having manipulated objects of VFP myself to create a single new object in form (control classes like xBox, PopCalc, DTPickerX, EditX, etc.) for my ssUltimate library, I do immediately got a "new perspective" of how a grid's column is composed of.  And this is what I am sharing here now.  How really is a column of a grid composed of?

Column's Composition

Originally I think of a column consisting of 3 objects.  A container, a header and a textbox (by default). His comments helped lift up the fog in my eyes which resulted to this new perspective of a grid's column's composition now.

Saturday, June 3, 2017

DTPickerX Revisited

Talking to one subscribers via FB Messenger last night made me aware that he is not aware of all of its feature so I decided to create this now to itemize its important features.

Return Values

Others may not be aware but it does not simply return a date or datetime value.  It returns a lot of other values as follows:

  • Value = depending on nLevel property, it can either return a date value or a datetime value
  • nYear = returns the numeric year of the selected date
  • nMonth = returns the numeric month of the selected date
  • nDay = returns the numeric day of the selected date
  • _BOM = always returns the beginning of month of the selected date
  • _EOM = always returns the end of month of the selected date
  • _DateTime = regardless of nLevel, always returns the datetine value of the selected date
  • SQLValue (new) = always return the date on YMD string format.  Useful for other backends such as MSSQL, MySQL, MariaDB or any other backend that requires the same format

Language Localization

Todate, dtPickerX supports seven (7) languages per request of subscribers as follows:

0=Indonesian, 1=English, 2=Italian, 3=Spanish, 4=Turkish, 5=Romanian, 6=German