Monday, January 16, 2017

GrdSortLock

grdSortLock

Also a replacement for both GridSort and GridLock classes.  This one combines both classes' capability into one. Like AnchorX, codes here are more simplified and straightforward.  

What it can do?

Provide instant sorting capability on your cursor used as grid's recordsource.  To use this class is as simple as dropping this class on form and declaring on target grid's INIT:

thisform.grdSortlock1._BindGrid(this)

By default, grid's column 1 will be sorted ASCENDING.  Left-clicking on other column headers will make that column the sorted one as long as the underlying ControlSource for that column is not of Blog, General or Memo type.

Right-clicking a column header pops up options as shown below.  So as the name says, it can sort and it can lock a column; or totally remove lock.

I urge my subsribers to likewise move into this later so I can also remove GridSort and GridLock (and again AnchorSizer) in the future from the library.

Saturday, January 14, 2017

AnchorX

I decided to revisit my AnchorSizer class because basically I just dragged the old ssAnchorSizer from ssClasses then dropped it to my ssUltimate library, and simply renamed it (as well as GridSort and GridLock).  My focus back then is on other new classes I was planning to make for ssUltimate and so I simply moved those ones there.

Today though, I decided to revisit my codes there... and I winced, LOL!  And shuddered too, which is what we normally experience for the sheer horror of seeing our old codes after learning better ones.  Anyway, I cannot simply remove that AnchorSizer anymore as others may be using those already plus while I do not like (now) the codes I used there and the way I manipulate resizing, those nevertheless work good on the resizing need.

So instead I created a new and better Sizer class for the insides of listbox, combobox and grid and named it simply as AnchorX.  So what has been changed here?

1.  Binding from anywhere on form.  Unlike its ancestors ssAnchorSizer (for ssClasses) and AnchorSizer (for ssUltimate) which has a rule that the class should be on the same container as that of the object(s) that will be bound to it, this one can be bound to object(s) from anywhere within the form, no matter how deep it is.

2.  Simplified codings.  No more Macro Substitutions (Ewwww!).  Shorter codes.  Reduced number of class properties needed to bare essentials.

3.  More precise calculations for resizing especially on grid.  Whereas before, I have to force adjust the last column, this one does a real accurate resizing based on original column widths plus your grid setup (are DeleteMark, RecordMark and Scrollbar shown or not?).

4.  Fixed problem on column naming on Grid.  It won't care anymore on the names of columns plus its position/order.

5.  No more extra call for its _Resize() method.  The class now binds itself on form's resize.  

6.  Simplified calls straightly referencing the actual objects.  This is only what we all need now:

* On combobox init:
Thisform.AnchorX1._cbo = this

* On grid init:
Thisform.AnchorX1._grd = this

* On listbox init:
Thisform.AnchorX1._lst = this


I urge my subscribers to replace AnchorSizer with AnchorX on their forms so I can totally remove that old class later from within the library.  That of course will happen pending their later confirmation to me that I can then safely remove that...that AnchorSizer.

Saturday, January 7, 2017

DTPeriod Class

NOTE:  I came to realize today that I have been skipping a subscriber on my updates because I forgot to add him on my list.  So if you are a subscriber and you have not been receiving any update for quite a while from me or you haven't received the update for this, kindly email me.  Also there are I think 1 or 2 emails of subscribers that no longer works.  Please contact me by mail so I can get the alternate email address.  You have to specify your old email address so I can verify.  Thank you!

=======

Update: Jan 14, 2017

- added hotkey to the datepicker even when popup calendar is not shown

- added Enter key to hide popup and finalize selection

- added Escape key to revert back to previous value disregarding current date selection

- Added Try..Catch with the help of Richard Kaye who found out about its need in this class.

====

This is two dtPickerX class for our two dates need (from and to).  This is quite simple.  Drop this class on your form and choose its orientation, 1 for portrait (default) and 2 for landscape.

Why not logical?  Instead of 1 for portrait, why not use .T. and .F. for landscape?  Well I plan to create a 3rd look for this later when I got time.

This returns two (2) values, i.e., ValueFrom and ValueTo which are already self-explanatory.  Since dtPickerX now has that HotKey, then this one has that too.  It automatically switch values ensuring that ValueFrom will always have the lowest or equal value than ValueTo, removing your need to code those yourself.

On form, during developing, you will only see one (1) dtPicker.  But on runtime, it will be shown like any of these depending on your orientation.



And Oh, you can assign initial values on those too:

* DtPeriod Init
this.valuefrom = DATE(2013,2,12)

DODEFAULT()


Date Scoping

Min and Max Values.  Two properties I added just now are ValueMin and ValueMax.  Those are optional.  If you leave both empty, then there is no scope restriction.  If you set just the ValueMin to say DATE(2013,1,1) or Date()-90 or GoMonth(date(),-3), then the dtpickers can not go lower than that.  If you also set ValueMax to a date, then the pickers will be restricted to those scope.

As usual, I am open to suggestions and comments for the betterment of the library from existing subscribers or even from those who plan to subscribe but is wishing some features I have not created yet.

Cheers!

See what's on ssUltimate:

http://sandstorm36.blogspot.com/2015/12/whats-on-ssultimate-library.html


CalendarX and DTPickerX Enhancements

I can safely claim that my calendar classes can compare with others when it comes to look and navigation speed being all the ingredients of a calendar are all staring the users in the eye (Months, Days and Year). And quite frankly, that is what IMHO makes it unique than others out in the market. And that is what makes my subscribers happy too.

Hotkey

Nevertheless, one of my new subscribers contacted me yesterday and inquired if it is possible to have hotkeys (shortcut keys) as well to navigate faster by keyboard for he is familiar with Quicken calendar which have those.  I said to myself, why not?  That is an improvement if I can think of a way to give those two classes that capability?  So I asked him to give me the hotkeys he is already familiar with.  Here is now the classes with the suggested hotkeys:



Why M for first day of month and moving backward one month later and H for the last day of month and moving one month forward later?  That is because it is easy to remember that M is the first letter of the word Month and H is the last letter, i.e., MontH.

Same as in YeaR.  That is quite ingenious by Quicken to have those hotkeys, if I may say so.  Very easy to remember.


This feature is now available for both CalendarX and DTPickerX classes.

Now, he is familiar with that and users of this library will all be, soon.  But what about other users? How would they remember such?  So I created a new property named _Expanded to allow the calendar portion of the class to be shown "initially" as Expanded (showing hotkeys) or not.  Default is .F.  Regardless of the initial appearance, interactively, users can Expand or Contract the class to show or hide the HotKey guides via clicking on the arrow keys or pressing those (right arrow key to expand, left arrow key to contract).  So they can refer to that guide until these hotkeys become imprinted on their minds then they can ignore seeing that hotkeys guide later.




Date Scoping

Added two (2) new properties named ValueMin and ValueMax.  Simply saying, this will restrict the class within those dates, if used.


Subscribers will be sent the update in a short while, but first I have to double check a new class I am working on called dtPeriod and ensure everything is okay.  For those who are becoming interested in subscribing to ssUltimate, click Contact Me above and shoot me an email.  Cheers!



Thursday, December 22, 2016

CtrlBox Class

This is another simple class that has been inside ssUltimate for quite a long time now.  But I designed this solely for the need of TitleBarX when I experimented on creating a control box that is purely made of shapes.  

However, recently I am changing my forms' appearances again and I now favor a form with no titlebar and border that is run maximized.  And while users of my app know they can always press Esc key to exit any of my forms, I still want an additional way for them to close it via a mouse.

I have other classes for those need, i.e., CloseX, CloseX2 and CloseX2s (smaller version).  But I suddenly thought last night it would be cooler to have a controlbox that has all that minimize, maximize/restore and close buttons.  Only that though. I still do not want a titlebar as I use vfp's own _Screen and having its titlebar and another titlebar below it does not appeal to me.

So I tweaked this one last night.  Now it can be dropped onto your form as well (if you intend to have a form that has no titlebar too) and it will adjust itself accordingly.  Though I have to kill its form pinning feature which is available for use in TitleBarX.

Here is how it looks like on one of my forms:



Wednesday, November 30, 2016

RTF Keyword Highlighting

In 2009 I started playing with an RTF control and I created one organizer for my own need to store articles and any other useful info I can find in the web for later offline reading and reference.  I decided to do that because most of the time we don't have good internet here.

Well I was reworking the previous days on that old DevOrg app which consisted of a treeview and an RTF activeX controls as I decided to finally give it a filtering capability, insertion of image with rescaling and quality reduction, reworking the icon panel to look like a ribbon, etc.; and along the way, I thought of allowing it to highlight the words I typed to filter the threads and nodes of treeview.  So I can see outright where those are, like this:




The trick is to work behind the scene on its RTF codes. Here is the method I created for that:

*_HighLight Method

Lparameters cWord
LOCAL lcTable
lcTable = thisform._currenttable
SELECT(m.lcTable)
Try
   * Insert highlight color
   lcRTFSource = Strtran(rtftext,'}}','}}'+Chr(13)+'{\colortbl ;\red0\green255\blue0;}')
   * Add new highlightings.  Check proper, small, all caps
   lcRTFSource = Strtran(m.lcRTFSource,m.cWord,'\highlight1 '+m.cWord+'\highlight0 ')
   lcRTFSource = Strtran(m.lcRTFSource,Upper(m.cWord),'\highlight1 '+Upper(m.cWord)+'\highlight0 ')
   lcRTFSource = Strtran(m.lcRTFSource,Lower(m.cWord),'\highlight1 '+Lower(m.cWord)+'\highlight0 ')
   lcRTFSource = Strtran(m.lcRTFSource,Proper(m.cWord),'\highlight1 '+Proper(m.cWord)+'\highlight0 ')
   Thisform.corTF.olerTF.textRTF=m.lcRTFSource
Catch
   Thisform.corTF.olerTF.textRTF = rtftext
Endtry


If you notice, I have used three (3) possible cases, i.e., UPPER(), LOWER() and PROPER().  The problem is I can't force the RTF codes to any of these cases alone to ensure I can highlight everything as that will also affect the output.  So say I filter threads for entries with the word "javascript", then it can find and highlight words with javascript, JAVASCRIPT and Javascript.  But not JavaScript.

While I can instruct it with another function/method to look for any other transmutation of the word like JavaScript, JAvascript, jaVaScript, etc., I think that is an overkill for this simple need of mine.

So anyway, I am just showing here the trick on how to achieve that in case you use and RTF tool on your end and wanted to have the same on your end.  Cheers!

Monday, November 14, 2016

HoverButton Class

Another button class for my need which may come handy to my subscribers as well.

So why make another one?  What is the main difference with this one vs say ButtonX?

On my BizCore ERP app, I use TreeView for my menu as I can easily control there what can be shown per user by hiding/removing nodes they should not be of concern.  See ERP app below:



However, for comparably smaller app like my Gift Voucher one, my GUI approach is different where I use background images plus images representing as button icons.  Why this design?  First, I want to give my users the capability to change wallpaper via a simple double-click.  That adds to user satisfaction because they won't be tied up with an appearance that they may not like as each user has his/her own taste.  Another is to make the app look bigger, LOL!  Here is that app showing different look impact by simply changing wallpapers.




And for that design, I need to have a button that will appear transparent and so this new control class.  ButtonX can be made transparent too via making nTheme parameter 0 (zero) and nLineSpecialEffect = 3.  However, when you do that, you won't see any hover effect (glowing blue) I did on MouseEnter here because that is tied up on the theme image which we ignored for transparency sake.   And so it is a bit harder to see where you are except on relying on the mouse pointer.


Unlike my other button classes, I made this one simpler via allowing the use of PEM instead of us typing This._setting(....) inside the class init.  So you can go to PEM and change its Picture, Caption, Enabled and ToolTipText.   Speaking of Enabled, when the class is toggled to disable, then these two (2) properties will have an effect on its appearance:

1.  _noHighlight (Default is .T.)  - When the class gets disabled, you won't see the hover effect of that glowing blue background.  Turn it to .F. to show that hover effect even if the class is disabled.


2.  _ShowLock (Default is .T.) - When the class gets disabled, a lock icon will appear on its top as additional visual guide.  If you don't want this, turn this property into .F.



Well that is it!  This is now part of ssUltimate.  Visit What's on ssUltimate Library for the list of classes inside ssUltimate.

Related Posts Plugin for WordPress, Blogger...