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
TEXT TO lcSQL NOSHOW 
Select vesselname,vesselid from Vessels
      where [MySearch] $ vesselname 
      order By
      into Cursor curVessel NOFILTER
ENDTEXT
This._searchgrid(m.lcSQL,'curVessel.VesselName')

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: http://sandstorm36.blogspot.com/2017/04/xbox-on-mysql-backend.html

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
TEXT TO lcSQL NOSHOW  
Select vesselname,vesselid from Vessels
      where [MySearch] $ vesselname 
      order By
      into Cursor curVessel NOFILTER
ENDTEXT
This._searchgrid(m.lcSQL,'curVessel.VesselName')

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.