General discussion

Locked

The SPS Weblog

By craig ·
Tags: Off Topic
blog root

This conversation is currently closed to new comments.

94 total posts (Page 3 of 10)   Prev   01 | 02 | 03 | 04 | 05   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Splitter Class for Visual FoxPro

by craig In reply to The SPS Weblog

<p>
A number of other languages have a splitter control of some sort, why not Visual FoxPro?
To be fair, I have seen some splitter classes floating around from time to time, but
I thought I'd try my hand at it. I was convinced it couldn't be too difficult, and
Visual FoxPro didn't disappoint me. Below is a download link for the class library
that I placed my splitter class in (based on shape) and an example form showing how
the class is used (I've taken a screen shot of it so you can see what it looks
like). Now, if you want to try the splitter class out before you go to the trouble
of downloading it, I've also created a cut-n-paste/execute example that you'll find
directly beneath the screen shot. This splitter control is designed to work with Visual
FoxPro 9.0. If you are using a previous version then you will need to modify/delete
a few things.
</p>
<p>
<a href="http://www.sweetpotatosoftware.com/files/splitter.zip">Download Splitter.vcx
and Form Example</a> (8 KB approx.)
</p>
<p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/splitter.gif" border=0>
</p>
<p>
*!* Cut-N-Paste the code below into a prg file and execute it to see and try out a
working example of the splitter class
</p>
<p>
PUBLIC oform1
</p>
<p>
oform1=NEWOBJECT("form1")<br>
oform1.Show<br>
RETURN
</p>
<p>
************************************<br>
DEFINE CLASS form1 AS form<br>
************************************
</p>
<p>
 DoCreate = .T.<br>
 Caption = "Splitter Example"<br>
 Name = "Form1"<br>
 MDIForm = .T.<br>
 Autocenter = .T.<br>
 <br>
 ADD OBJECT text1 AS textbox WITH ;<br>
  Anchor = 11, ;<br>
  Height = 29, ;<br>
  Left = 0, ;<br>
  Top = 0, ;<br>
  Width = 375, ;<br>
  Name = "Text1"
</p>
<p>
 ADD OBJECT edit1 AS editbox WITH ;<br>
  Anchor = 7, ;<br>
  Height = 217, ;<br>
  Left = 0, ;<br>
  Top = 33, ;<br>
  Width = 184, ;<br>
  Name = "Edit1"
</p>
<p>
 ADD OBJECT edit2 AS editbox WITH ;<br>
  Anchor = 15, ;<br>
  Height = 217, ;<br>
  Left = 188, ;<br>
  Top = 33, ;<br>
  Width = 187, ;<br>
  Name = "Edit2"
</p>
<p>
 ADD OBJECT splitter1 AS splitter WITH ;<br>
  Top = 32, ;<br>
  Left = 183, ;<br>
  Height = 219, ;<br>
  Width = 6, ;<br>
  Anchor = 7, ;<br>
  Name = "Splitter1"
</p>
<p>
 ADD OBJECT splitter2 AS splitter WITH ;<br>
  Top = 28, ;<br>
  Left = 0, ;<br>
  Height = 6, ;<br>
  Width = 376, ;<br>
  Anchor = 10, ;<br>
  vertical = .F., ;<br>
  minimumsize = 29, ;<br>
  Name = "Splitter2"
</p>
<p>
 PROCEDURE Init<br>
  This.text1.Value = "Visual FoxPro Rocks!"<br>
  This.Edit1.Value = "Visual FoxPro is an extremely versatile development
tool. " + ;<br>
    "Not only does it allow a developer to create great datacentric
applications, " + ;<br>
    "it also allows the developer to extend the actual language
with new classes, " + ;<br>
    "code libraries, and hooks. If you're an avid Visual FoxPro
developer like myself " + ;<br>
    "then good for you. And, if you're not, then I encourage you
to give Visual FoxPro " + ;<br>
    "a try. You won't regret it"<br>
  This.Edit2.Value = "This is an example of a splitter class for use in
Visual FoxPro 9.0 forms. " + ;<br>
    "It is pure Visual FoxPro, so there aren't any additional
ActiveX or DLL dependencies " + ;<br>
    "to worry about when distributing your application. To see
it in action move the " + ;<br>
    "horizontal and vertical splitters around on this form. Also,
by resizing the form you " + ;<br>
    "can see that it handles the new Visual FoxPro 9.0 Anchors
property with aplomb."<br>
 ENDPROC
</p>
<p>
ENDDEFINE
</p>
<p>
************************************<br>
DEFINE CLASS splitter AS shape<br>
************************************<br>
 Height = 182<br>
 Width = 8<br>
 MousePointer = 9<br>
 SpecialEffect = 0<br>
 Style = 0<br>
 mousedownat = 0 && Tracks mouse and allows class to ignore moves caused
by resizing form<br>
 vertical = .T. && Set to .F. for horizontal splitter<br>
 minimumsize = 40 && This is how small (in pixels) the panels can get
when moving the splitter<br>
 Name = "splitter"
</p>
<p>
 PROCEDURE MouseLeave<br>
  LPARAMETERS nButton, nShift, nXCoord, nYCoord<br>
  This.mousedownat = 0<br>
 ENDPROC
</p>
<p>
 PROCEDURE Move<br>
  LPARAMETERS nLeft, nTop, nWidth, nHeight<br>
  *!* If you want to move the splitter during runtime and have it move the
other controls<br>
  *!* then set mousedownat != 0 and call this move method of the splitter<br>
  *!* remember to set mousedownat back to 0 when you are done moving the
splitter
</p>
<p>
  LOCAL loControl, llLockScreenWas, lnMovement, llIsSplitter, lcUniqueTag,
lnMarginOfError, lnAnchorWas<br>
  IF this.MouseDownAt == 0<br>
   DODEFAULT(m.nLeft, m.nTop, m.nWidth, m.nHeight)<br>
   RETURN<br>
  ENDIF
</p>
<p>
  m.loControl = NULL
</p>
<p>
  *!* The following tag can be placed in controls you don't want moved as
well<br>
  m.lcUniqueTag = "DoN't_MoVe_SpLiT" && Just something that is pretty
well guaranteed to be unique<br>
  THIS.TAG = m.lcUniqueTag<br>
  m.llLockScreenWas = THISFORM.LOCKSCREEN && JIC the screen was
already locked<br>
  THISFORM.LOCKSCREEN = .T.
</p>
<p>
  m.lnMovementLeft =  m.nLeft - THIS.LEFT<br>
  m.lnMovementTop =  m.nTop - THIS.Top
</p>
<p>
  FOR EACH m.loControl IN THIS.PARENT.CONTROLS<br>
   IF m.loControl.TAG = lcUniqueTag && this splitter so just
loop<br>
    LOOP<br>
   ENDIF<br>
   IF PEMSTATUS(m.loControl,"Anchor",5)<br>
    m.lnAnchorWas = m.loControl.Anchor<br>
    m.loControl.Anchor = 0<br>
    m.llIsSplitter = m.loControl.CLASS = "Splitter"<br>
    IF THIS.vertical && Vertical Splitter<br>
     lnMarginOfError = INT(This.width/2) && JIC the
developer got the splitter a little too close<br>
     IF m.loControl.LEFT <= THIS.LEFT && Control
is to the left of splitter<br>
      IF (m.loControl.LEFT + m.loControl.WIDTH) <=
(THIS.LEFT + lnMarginOfError) AND !m.llIsSplitter<br>
       m.loControl.WIDTH = MAX(m.loControl.WIDTH
+ m.lnMovementLeft, 0)<br>
      ENDIF<br>
     ELSE  && Control is to the right of splitter<br>
      IF !m.llIsSplitter<br>
       m.loControl.WIDTH = MAX(m.loControl.WIDTH
- m.lnMovementLeft, 0)<br>
      ENDIF<br>
      m.loControl.LEFT = m.loControl.LEFT + m.lnMovementLeft<br>
     ENDIF<br>
    ELSE && Horizontal Splitter<br>
     lnMarginOfError = INT(This.Top/2) && JIC the
developer got the splitter a little too close<br>
     IF m.loControl.TOP <= THIS.TOP && Control
is above the splitter<br>
      IF (m.loControl.TOP + m.loControl.HEIGHT) <=
(THIS.TOP + lnMarginOfError) AND !m.llIsSplitter<br>
       m.loControl.HEIGHT = MAX(m.loControl.HEIGHT
+ m.lnMovementTop, 0)<br>
      ENDIF<br>
     ELSE  && Control is below the splitter<br>
      IF !m.llIsSplitter<br>
       m.loControl.HEIGHT = MAX(m.loControl.HEIGHT
- m.lnMovementTop, 0)<br>
      ENDIF<br>
      m.loControl.TOP = m.loControl.TOP + m.lnMovementTop<br>
     ENDIF<br>
    ENDIF<br>
    m.loControl.Anchor = m.lnAnchorWas<br>
   ENDIF<br>
  NEXT<br>
  m.lnAnchorWas = This.Anchor<br>
  This.Anchor = 0<br>
  DODEFAULT(m.nLeft, m.nTop, m.nWidth, m.nHeight) && Finally move
the splitter<br>
  This.Anchor = m.lnAnchorWas<br>
  THISFORM.LOCKSCREEN = m.llLockScreenWas<br>
  THIS.TAG = ""<br>
 ENDPROC
</p>
<p>
 PROCEDURE MouseMove<br>
  LPARAMETERS nButton, nShift, nXCoord, nYCoord<br>
  LOCAL lnMovement<br>
  IF m.nButton = 1 AND !(this.mousedownat == 0)<br>
   IF THIS.vertical<br>
    IF m.nXCoord != THIS.mousedownat<br>
     m.lnMovement = m.nXCoord - THIS.mousedownat<br>
     IF BETWEEN(THIS.LEFT + m.lnMovement, This.minimumsize,
THIS.PARENT.WIDTH - THIS.WIDTH - This.minimumsize)<br>
      THIS.MOVE(THIS.LEFT + m.lnMovement, THIS.TOP,
THIS.WIDTH, THIS.HEIGHT)<br>
      THIS.mousedownat = m.nXCoord<br>
     ENDIF<br>
    ENDIF<br>
   ELSE && Horizontal<br>
    IF m.nYCoord != THIS.mousedownat<br>
     m.lnMovement = m.nYCoord - THIS.mousedownat<br>
     IF BETWEEN(THIS.TOP + m.lnMovement, This.minimumsize,
THIS.PARENT.HEIGHT - THIS.HEIGHT - This.minimumsize)<br>
      THIS.MOVE(THIS.LEFT, THIS.TOP + m.lnMovement,
THIS.WIDTH, THIS.HEIGHT)<br>
      THIS.mousedownat = m.nYCoord<br>
     ENDIF<br>
    ENDIF<br>
   ENDIF<br>
  ENDIF<br>
 ENDPROC
</p>
<p>
 PROCEDURE MouseDown<br>
  LPARAMETERS nButton, nShift, nXCoord, nYCoord<br>
  IF THIS.vertical<br>
   THIS.mousedownat = nXCoord<br>
  ELSE<br>
   THIS.mousedownat = nYCoord<br>
  ENDIF<br>
 ENDPROC
</p>
<p>
 PROCEDURE Init<br>
  IF !THIS.vertical<br>
   THIS.MOUSEPOINTER = 7 && NS<br>
  ENDIF<br>
 ENDPROC
</p>
<p>
 PROCEDURE MouseUp<br>
  LPARAMETERS nButton, nShift, nXCoord, nYCoord<br>
  This.mousedownat = 0<br>
 ENDPROC<br>
 <br>
ENDDEFINE<br>
</p>
<br>
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,cbfe9ce7-8b19-4374-8c52-132a853ef7b3.aspx">This post originally appeared on an external website</a></div>

Collapse -

Skinning a Form in Visual FoxPro

by craig In reply to The SPS Weblog

<p>
Sometime ago I incorporated <a href="http://www.vfpskin.com.ar/">VFPSkin</a> elements
into a project I was working on. This was when VFPSkin had first come out (version
1.0?) and was still free and open source. I was pretty impressed with VFPSkin
as I had never seen skinning for Visual FoxPro applications prior to this. It was
a little buggy and I made a lot of modifications, but overall the idea was sound and
ingenious. (Just for the record, I made it a point not to look at VFPSkin's source
code while I created the example for this blog entry. I admit having been exposed
to VFPSkin and thus influenced by it, but the code and parts of this example
were created from scratch.)
</p>
<p>
So, that was extent of my exposure to skins in Visual FoxPro... fast forward
to today. I decided to take a look at creating a simplified way to skin Visual FoxPro
screens. Why? Well, as with most of my ideas and side projects, sometimes it's the
challenge and other times I just have an idea for something that might be helpful
to the Visual FoxPro Community and I want to explore it a little. In this case,
as in most, it was a little of both. I call this project "Green Screen".
</p>
<p>
The idea was to take a single ordinary bitmap that has a unique background
color (transparency key if you will), use it for the picture property of a form, and
then carve out everything at runtime based on that unique color. In this case I chose
green for the color -- just like in the movies (that's where I got the idea,
though these days I think Hollywood uses mostly blue) -- and I created a simple sample
skin that I could use during development.
</p>
<p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/greenscreenbmp.gif" border=0>
<br>
<font color=#008000>Green Screen Skin Bmp</font>
</p>
<p>
Using some API calls (<font face=Tahoma size=2>CreateRectRgn and </font><font face=Tahoma color=#000000 size=2>CombineRgn in
GDI32 and SetWindowRgn in USER32) the project quickly progressed and I soon had
a form that displayed just the intended portion of the bitmap skin. Next it was time
to create a routine that would allow Visual FoxPro developers to use their own bitmaps
and create "skin definition files" based on them. I decided to incorporate this portion
into my example form as well.</font>
</p>
<p>
<font face=Tahoma color=#000000>This is just a quick initial stab at it... consider
it a pretty decent proof of concept. My ultimate goal for this portion was to show
Visual FoxPro developers how skinning can be accomplished in a simple, straightforward
way. It took much less than a day to get this far, so imagine what can be done given
time. Next up on my todo list will be the ability to resize the form (as well as maximize
and minimize) and also the ability to skin/unskin on demand as well as the ability
to change skins on the fly. I will be keeping an eye towards simplicity throughout,
as I want this to be a very painless tool for Visual FoxPro developers to use.</font>
</p>
<p>
<font face=Tahoma color=#000000>A couple of quick final notes: The two methods in
the example form that you'll want to take a look at are createskindefinition and readskindefinition.
Though I chose green as the unique color, it can be anything. The readskindefinition
method will look at a single pixel in the bottom left of your bitmap to determine
the color that should be carved out of the form. All in all, I think you might be
surprised at minimal amount of code it took to actually pull this off. Here's a screen
shot of the example and the customary download link. </font>
</p>
<p>
<font face=Tahoma color=#000000><a href="http://www.sweetpotatosoftware.com/files/greenscreen.zip">Download
Green Screen Example</a> (10 KB approx.)</font>
</p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/greenscreen.gif" border=0>
<br>
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,9a91dea3-6413-42e9-aeff-f0097937474d.aspx">This post originally appeared on an external website</a></div>

Collapse -

Rubberband Selections in Visual FoxPro

by craig In reply to The SPS Weblog

<p>
The day before yesterday I was surfing my blogroll and came across an interesting
post by Calvin Hsia -- "<a href="http://blogs.msdn.com/calvin_hsia/archive/2005/08/11/450587.aspx">Enable
crop and zooming in on your digital photograph display form</a>". It was using GDI+
in a Visual FoxPro form and, since I am writing a series of articles for FoxTalk on
the subject, it caught my eye. One of the things I liked the most about Calvin's entry
was the idea of using a shape in order to create a rubberband selection area; basically a
rectangle with a dotted line border that you may have noticed once or twice in
various Windows applications (still don't know what I'm talking about? Go to your
desktop and left click and drag a rubberband selection area around some icons -- or
just look at the screen shot below). I came away from Calvin's entry thinking he had
a great idea, so I've implemented my own and expanded on it.
</p>
<p>
I created a class called "rubberband" that can be added through code to any form
during runtime. It facilitates a rubberband selector when the user drags their mouse
over the surface of the form. This class has several features that I thought would
be useful to a developer.
</p>
<ul>
<li>
The rubberband is reversible, meaning it can follow the mouse no matter which way
the user maybe dragging their selection area.
<li>
It provides feedback when the selection is started, when the selection area is
changed, and also when the selection has been completed.
<li>
It has an optional feature that will allow you to get a collection of the selected
objects as well as a collection of objects that aren't selected based on the selection
area. This is turned on or off via a property of the class named "selectobjects"
<li>
Left or right mouse button can be specified as the active mouse button that creates
the rubberband selection areas.
<li>
Optional keys (shift, alt, or ctrl) can also be specified as required during the selection
(such as, the user must hold the alt key down while dragging with the left mouse button
depressed).</li>
</ul>
<p>
The class makes liberal use of Visual FoxPro's Bindevent function to monitor the user's
activity on the form's surface. And, the example form I'm including in the download
uses bindevents as well to receive feedback from the rubberband class. All-in-all,
it turned out to be a pretty workable solution and implementation of Calvin Hsia's
idea.
</p>
<p>
One of the problems I ran into however, was when the mouse was over a particular object
on the form, the form obviously didn't receive the mouse events... so the rubberband
just stops. The solution for this example was to send the mouse events up the chain
to the parent form. However, in perhaps a future blog entry I will use the vfpex.fll
with its BindEventEx/UnBindEventEx functions (if interested you can read my <a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,f7644db8-b155-4d43-8216-4cfde233edb7.aspx">earlier
blog post regarding vfpex.fll</a&gt in order to create a mouse hook and keyboard hook in
order to facilitate this without having to send mouseevents up to the parent
object. I'm not sure if BindEventEx would be needed or not, perhaps Visual FoxPro
9.0's BindEvent would be enough... never hit something with a sledgehammer when a
simple tap will do.
</p>
<p>
Before I go, I just want to say that I highly recommend <a href="http://blogs.msdn.com/calvin_hsia/default.aspx">Calvin
Hsia's WebLog</a>, there's a lot of great content there... especially in the archives.
Who knows, if enough people take an interest in his blog, he might give us more secrets.
:) Now, without any further ado here's the usual screen shot and download link. (oh,
and by the way, that weird thing with the fonts getting bolder as the form repaints
definitely needs to be fixed in Visual FoxPro 9.0 -- I've left it in this example
to maybe draw some more attention to it, see the checkboxes as you play with the example).
</p>
<p>
<a href="http://www.sweetpotatosoftware.com/files/rubberband.zip">Download Rubberband
Selector Class and Example Form</a> (9 KB approx.)<br>
<br>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/rubberband.gif" border=0>
</p>
<br>
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,de3b099f-bca6-471e-89bf-ae094b823780.aspx">This post originally appeared on an external website</a></div>

Collapse -

Undocument SYS() Functions

by craig In reply to The SPS Weblog

<p>
Most of what I'm about to show is more oddity than useful. There are a number of undocumented
functions, commands, and other oddities (remember the mousewheel event being used
to create a workable systray class?) in Visual FoxPro. From time to time developers
will run into them while testing, or someone on the MS Fox Team will mention them,
or Visual FoxPro enthusiasts will go looking for them.
</p>
<p>
Here are some odd Sys() functions that appear to be undocumented. I've included the
nValue as well as the eValue where applicable. So for..
</p>
<p>
988: evalue .T. or .F. returned previous setting
</p>
<p>
...I'm saying that you can either run ?SYS(988, .T.), or ?SYS(988, .F.) and that the
return value will be whatever you sent as a parameter the last time. I hope that makes
sense, if not, then just try a few out and I think what I'm posting will be more understandable.
</p>
<p>
I realize that I didn't organize this list very well, but I'm in a hurry and
just wanted to throw this in a quick blog entry (sorry organization and a sorry excuse
- what can I say?).  Whether any of these SYS() functions do anything useful
I don't know -- definitely SYS(1079, 0) is not useful -- handle that one with care.
</p>
<p>
Just so you know, the criteria I used to decide whether a SYS() function did something
undocumented was if it was checking the type of the eValue (parameter sent in) and/or
returned a value when called.  I feel that the SYS(999) and SYS(2901) are pretty
interesting (I've included some code so you can explore them) and some of
the SYS() functions that returned numeric values intrigued me as well. I tried to
figure out what those numeric values were pointing to, but was unable to decipher
them. I feel that perhaps they are handles or pointers of some kind.  Anyone
with any additional information, feel free to chime in (Calvin?).
</p>
<p>
Lastly, I recall seeing a list like this years ago. I thought Steven Black had compiled
it, but for the life of me I couldn't find it on the net. So, if anyone knows where
that list is, I'd appreciate it if you would comment with the link to it. Thanks.
</p>
<p>
Here's my compiled list...
</p>
<p>
988: evalue .T. or .F. returned previous setting<br>
989: evalue 0 or 1 Returned previous setting<br>
999: evalue 1-4417 (accepts up to 4999 without error) brought up windows
</p>
<p>
***************************************<br>
*!* Program to show some example windows from 2901<br>
*!* Press tab to move to next window<br>
SYS(999, 26)<br>
SYS(999, 500)<br>
SYS(999, 2999)<br>
SYS(999, 4417)<br>
***************************************
</p>
<p>
1004: returned 10105192 (increments?)<br>
1005: returned 1220846 (increments?)<br>
1006: returned 1218880 (increments?)<br>
1011: returned 1967 (different at times)<br>
1012: returned 5901<br>
1013: returned 1063636632 (changes depending on a number sent in, otherwise same)<br>
1017: returned 11163028 (changes but same after being called... don't know what changes
it though)<br>
1018: returned "Hold Index Lock during TableUpdate: On"<br>
1021: evalue 0-65535 returned nothing<br>
1029: evalue 0-65535 returned nothing<br>
1039: evalue 0 to non-zero returned previous setting "ON" or "OFF" (zero was considered
off)<br>
1079: C5 error everytime takes numeric parameter<br>
1101: returned 358875136<br>
1102: returned 1609982<br>
1103: returned 364798<br>
1105: returned 365622 (different depending on window it is run from)<br>
2050: evalue 0-10 returned parameter sent in<br>
2400: evalue 0-1 returned 0 when 0 or nothing was sent in otherwise blank<br>
2701: returned "{1:0, t:0, w:0, h:0}"<br>
2901: evalue 0-9727 returned VFP string table && there is more further up,
but I stopped at 9727
</p>
<p>
***************************************<br>
*!* Program to show strings for 2901<br>
*!* The following parameters will cause buffer overflow errors that shut Visual FoxPro
down<br>
*!* So we'll avoid them<br>
ALINES(aryBufferOverflow, "604,801,802,835,2483,2489,2511,2533,2538,2556,2792,2811,"
+ ;<br>
   "2832,2845,2961,2975,2985,2987,2988,3039,3120,3407,3433,3478,3516,3517,"
+ ;<br>
   "3527,3532,3541,3546,3549,3550,4416,4673,4720,4795,4799,4812,4834,4882,4884,"
+ ;<br>
   "48**,4979,4999,5005,5015,5098,5103,5571,5601,5882,6584,7427,7433,7434,"
+ ;<br>
   "7437,7467,7482,7489,7493,7498,7511,7537,7551,7567,7578,7631,7634,7636,"
+ ;<br>
   "7653,7662,7673,7675", 1, ",")<br>
IF FILE("C:\VFPSys2901.txt")<br>
 ERASE("C:\VFPSys2901Strings.txt")<br>
ENDIF<br>
FOR lnCounter = 0 TO 9727<br>
 WAIT WINDOW "One moment...  " + PADL(TRANSFORM(INT(lncounter / 9727 * 100))
+ "%", 4, " ") NOWAIT<br>
 IF ASCAN(aryBufferOverflow, TRANSFORM(lnCounter)) = 0<br>
*!*   ?lnCounter<br>
  =STRTOFILE("SYS(2901, " + TRANSFORM(lnCounter) + ") = " + SYS(2901, lnCounter)
+ CHR(13), "C:\VFPSys2901Strings.txt", 1)<br>
 ENDIF<br>
ENDFOR
</p>
<p>
IF FILE("C:\VFPSys2901.txt")<br>
 MODIFY FILE ("C:\VFPSys2901Strings.txt")<br>
ENDIF<br>
*****************************************
</p>
<p>
3090: evalue 0 or 1 Returned previous setting<br>
3100: evalue accepts positive integers returns nothing<br>
4000: to 4004 will error with "feature is not available"<br>
4010: will error with "feature is not available"<br>
4015: evalue accepts anything returns 0<br>
>4015: reutrns nothing, I checked up to 100,000,000<br>
-1: and below work same as sys(0)
</p>
<br>
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,04154aac-db86-4a65-acfd-8691ca1cb4fc.aspx">This post originally appeared on an external website</a></div>

Collapse -

Fox Quotes for The FoxShow

by craig In reply to The SPS Weblog

<p>
<p><a href="strong>Andrew">http://akselsoft.blogspot.com/"><strong>Andrew MacNeill</strong></a> of <a href="strong>AKSEL">http://www.aksel.com/"><strong>AKSEL Solutions</strong></a> has been doing a stellar job with <a href="strong>The">http://www.thefoxshow.com/"><strong>The FoxShow</strong></a> podcast. If you're a Visual FoxPro developer, you'll find his podcasts informative and useful. The topics run the gamut and it's one of the most ingenious forms of homegrown PR work for Visual FoxPro that I've seen in some time. It definitely deserves the Visual FoxPro Community's support, and on that note, I provide the following snippet from a recent post Andrew made on <a href="strong>ProFox</strong></a>:</p>">http://leafe.com/mailman/listinfo/profoxtech"><strong>ProFox</strong></a>:</p>
<p>"... <em>As some of you know, I'm hosting the Fox Show, a podcast about Visual FoxPro , software development, yada yada yada. (go to <a href="strong>http://www.thefoxshow.com</strong></a>">http://www.thefoxshow.com/"><strong>http://www.thefoxshow.com</strong></a> </em><em>if you want to listen or subscribe in iTunes, etc)</em></p>
<p><em>I've been retooling the show of late and what I'd love to have is little "Fox Quotes", quotes from developers who use FoxPro, promoting their web site and themselves but mostly FoxPro. (if you do want to do an interview, skype me and we can set it up)</em></p>
<p><em>If you can (or want to), just record a little MP3 (or WMA or whatever audio </em><em>file) that essentially says:</em></p>
<p><em><strong>Hi. This is __________________, from ________________.
</strong></em><em><strong>I've been using FoxPro since __________ (version or year).
My favorite FoxPro feature is _______________. (if you want to describe it go ahead).
My biggest FoxPro gripe is ___.
You can reach me at www._____________________.
You're listening to the FoxShow podcast!</em></strong>

<p><em>Your favorites or gripes can be as long or as short as you want. This is more for "fun" filler stuff as I'm hearing from a lot of listeners that they are "lone developers" and love to really hear others talk about their stuff.</em></p>
<p><em>Email it to akselsoft at gmail dot com. Don't worry if you feel it's too long or whatever, I can edit it if need be. </em></p>
<p><em>Also, if you have a product, topic, or anything at all you want to discuss, shoot me an email, skype me, whatever and we can arrange it." -- end quote</em></p>
<p>I've changed his email address to obfuscate it somewhat from the spammers and hope that "<em>akselsoft at gmail dot com</em>"is easy enough to figure out. I don't mind people posting my email <a href="mailto:craig@sweetpotatosoftware.com"><strong>craig@sweetpotatosoftware.com</strong></a> address without obfuscating it, but without prior permission or knowing the person's preference, I try to be considerate.</p>
<p>Well, if you haven't sent Andrew a "Fox Quote" yet, I encourage you to do so (mine went out today). As I've said before, there are many ways to support the Visual FoxPro Community and our beloved product. Andrew, if you're listening... Thank You!</p>

<p>
<p>
<p></em>


<p>
<div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,016c441b-d94d-41f0-b020-116012860ff6.aspx">This post originally appeared on an external website</a></div></font></font></font></font></em>

Collapse -

Have a Blog? Consider having it copied on TechRepublic

by craig In reply to The SPS Weblog

<p><strong>TechRepublic offers to mirror blogs<br /></strong>William Sanders of <a href="http://www.dotnetconversions.com">Electronic Filing Group</a> posted on the <a href="http://leafe.com/mailman/listinfo/profoxtech">ProFox</a> yesterday that <a href="http://www.techrepublic.com">TechRepublic</a> was offering a blog mirror service. It sounded like an interesting idea so I've given it a try. </p>
<p><strong>How does it work?<br /></strong>Basically TechRepublic will poll your blog every 4 hours for new content and copy it entry-for-entry into the blog mirror up on their site. </p>
<p><strong>Why would you want to do this?<br /></strong>First, Visual FoxPro related content will be given a higher profile. TechRepublic is a fairly respected source for IT related content on the web. Many developers, IT personnel, and computer enthusiasts read TechRepublic on a regular basis and having them run into a little Visual FoxPro from time to time would be a good thing. </p>
<p>Second, it increases the visibility of your blog/website. This can increase traffic and even possibly up your PageRank (PR). In my case this is a very real possibility given that each of my blog entries have "<font color="#0000ff">This weblog is sponsored by </font><a href="http://www.sweetpotatosoftware.com/">SweetPotato Software, Inc.</a>" at the bottom of them. TechRepublic has a current PR of 8 out of 10, so unless your site has a ranking of 9 or 10 (unlikely) it is a good thing to have links back to your site from TechRepublic. If you'd like to see what your PageRank is, you can surf on over to <a href="http://rankwhere.com/google-pagerank.php">http://rankwhere.com/google-pagerank.php</a> </p>
<p>Third, there is very little downside. A TechRepublic membership is free. The blog mirror service is free. The question becomes, why not do it? The only thing that I can think of is perhaps a sense of loss of control by some, but the content comes directly from your blog, and you can delete your blog out on TechRepublic at any time. </p>
<p><strong>What is my experience so far?<br /></strong>Admittedly I've only been up there since yesterday. But, I found the process rather painless and the content was copied as advertised. I have noticed that some of my images are a little wide for the fixed-width format of the TechRepublic website, but other than that I am pleased with the results so far. Which is the reason behind this blog entry.<br /><br /><strong>Where to go to get your blog mirrored?</strong> <br />Just venture out to <a href="http://www.techrepublic.com/">http://www.techrepublic.com</a> and, after signing in or creating a new membership account, click on the Blogs area and then click on the "My Blog" link. (There is also a "My Blog" link at the very top right of TechRepublic, but I'm not sure if that was there before I created my blog mirror out there or not). Once you're on the page for creating your blog, put in the name and description of your blog and then check the provided <font size="2">"Import your existing blog into TechRepublic" checkbox and type the URL to your RSS feed in the provided text field. Finally click "Save My Settings" to submit, and within 4 hours your blog entries should show up on TechRepublic.</font></p>
<p><font size="2">As a community, I think it's important for us to find ways to promote Visual FoxPro... this is just one example where we can perhaps make a difference. Thank you William for bring this to my attention. </p>
<p>PS As of this writing the SPS Blog is the most popular blog on TechRepublic. LOL! Here is the link to my blog out there: <a href="http://techrepublic.com.com/5247-6257-0.html?id=4031312">http://techrepublic.com.com/5247-6257-0.html?id=4031312</a> </p><br />
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato Software, Inc.</a>
<p>
<div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,7bdffcaa-01e1-4165-ba52-a3548aef10b4.aspx">This post originally appeared on an external website</a></div></font>

Collapse -

Visual FoxPro Grid - A Tip and a Calendar Class

by craig In reply to The SPS Weblog

<p>
<strong>Visual FoxPro's Grid<br>
</strong>It is my opinion that the Visual FoxPro grid has gotten a bum rap at times.
Though it does possess it's share of eccentricities, it is probably one of the most
powerful and useful controls I have ever had the pleasure of working with. The things
that it is capable of doing are simply amazing. Heck, you can have multiple controls
in a column or even put a grid inside a grid, so you essentially have a row/column
intersect (cell) representing many records.
</p>
<p>
In this entry, I want to show you a little known feature of the grid control. If you
know about this feature, then you are one of a handful. When the grid is refreshing or
otherwise repainting it will access the backstyle for every control the columns
contain, and anything you do in there will stick for the individual controls shown
in the grid.
</p>
<p>
<strong>Some help from the MS Fox Team<br>
</strong>Allow me to try and clarify... let's say you have a grid with a single column
and that column contains Textbox1. If you set the backcolor of the Textbox1 through
code to, let's say, the color Red, then every cell shown in column1 will turn red.
So, how to get dynamic colors (individual cells colored differently within the same
column)? Well, the MS Fox Team provides us with some dynamic properties of the column
object that will act on individual cells (DynamicAlignment, <strong>DynamicBackColor</strong>,
DynamicCurrentControl, DynamicFontBold, DynamicFontItalic, DynamicFontName, DynamicFontOutline,
DynamicFontShadow, DynamicFontSize, DynamicFontStrikeThru, DynamicFontUnderline, DynamicForeColor,
and DynamicInputMask). These are all very useful, and in the scenario I provided the
DynamicBackColor will work nicely to change the backcolor of individual cells within
a column of the grid. But what if you wanted to do something more complex? What if
you had a container in the column and that container contained multiple objects and
you wanted to set their forecolors and backcolors to completely different colors dynamically
or what if you wanted to display different pictures within the grid cells?<br>
<br>
<strong>Developers' usual and ingenious solutions<br>
</strong>One approach to these problems is to use multiple controls within the
column of the grid and then use DynamicCurrentControl to decide which to display.
Such as one textbox that has a red background and another that has a white background,
or different image controls all set to different pictures.<br>
<br>
Another ingenious method some Visual FoxPro developers imploy when solving this problem
is to subclass the column object and then "hook" into a non-used dynamic property
of the column to use it for other purposes (Such as DynamicForeColor) If the ForeColor
is being set to 1 then do this, if the forecolor is being set to 2 do something else,
if the forecolor is 3... and so on. While this approach and the preceding one are
both valid way of doing this, there is another way.
</p>
<p>
<strong>Another way<br>
</strong>As previously noted, the backstyle is accessed for the currentcontrol in
a column, and it's not accessed just once, it is accessed for every visible cell
in the grid. So, using this we can do nearly whatever we want as far as dynamic formatting
and display. Want different images displayed? Just subclass a container and put an
image control within it and place it in the column. Then, in the backstyle_access
method (you'll need to add this access method to the subclassed container) set the
value of the contained image's picture property to a field in the recordsource
that holds all the different paths in the image's backstyle_access method.
</p>
<p>
this.picture = crsImages.Paths
</p>
<p>
There's an example of doing this included in the download. When you run the example
it will ask you for a directory containing images. If one is not readily available
to you, you can select the folder the project is in because I have included
the below screen shots in it. This solution is more efficient than having an
image control in the column for each image you want displayed in the grid... 100 images
= 100 image controls? I'd rather just deal with one.
</p>
<p>
<strong>Calendar class and real world example<br>
</strong>OK, but what about something a little more real world? What kinds of things
is being able to dynamically alter items within a container using the backstyle_access good
for? All sorts of stuff. In order to demonstrate the just one useful example
of this, I put together some quick calendar demos. I've created an advanced calendar
class using the grid control. This should demonstrate well the power of utilizing
backstyle_access in a grid, not to mention the power of Visual FoxPro. Below is
the download link for the project source and some screen shots (so you can know what
to expect). There is an executable provided in the source folder for running the examples,
or if you prefer you can run the forms individually. The examples were created using
Visual FoxPro 9.0, so if you're using an earlier version you will have to modify the
code or better yet, upgrade! There are more great things to come, Visual FoxPro Rocks!
</p>
<p>
<a href="http://www.sweetpotatosoftware.com/files/vfpcalendar.zip">Download VFP Calendar
Examples and Source</a>
</p>
<p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/examplemonth.gif" border=0>
<br>
<font color=#008000>Just a simple calendar</font>
</p>
<p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/exampleoptions.gif" border=0>
<br>
<font color=#008000>Demonstrates some of the advanced display features of the calendar
class</font>
</p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/examplepickers.gif" border=0>
<br>
<font color=#008000>Improved Date and DateTime controls created using the calendar
class</font>
<br>
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,878c1b11-1770-405c-92ea-cdbe2c838dfa.aspx">This post originally appeared on an external website</a></div>

Collapse -

Visual FoxPro Progress Bar Class

by craig In reply to The SPS Weblog

<p>
<strong>Progress bars everywhere you look</strong>
<br>
I've created Visual FoxPro progress bars before (who among us hasn't right?).
The last time I developed one, I posted it over in the download section of <a href="http://www.universalthread.com/">Universal
Thread</a>. It is a COM server progress bar that allows progress indication to
smoothly continue even when Visual FoxPro is busy churning away on a single line of
code. But in today's project, I set out to create a simpler progress bar that could
be placed in a container (form or whatever).<br>
<strong>
<br>
Another progress bar class</strong>
<br>
I wanted this progress bar to look really professional. I also wanted it to handle
being resized to any length or width by the developer during design. I then wanted
it to either do a solid bar or create individual blocks like we see in the standard Windows
XP progress bar and I wanted it to have the ability to show the percentage complete
with a label that would change color as the progress bar went over the top of it (so
at 50%, half of the 50% is one color and the other half another). Finally it had to
be able to display different colors (green as in Windows XP, as well as red and
blue). These are all features I've seen in other progress bars, and felt that Visual
FoxPro could use one too.<br>
<strong>
<br>
Progressbar properties of note</strong>
<br>
<strong><font color=#008000>barcolor</font></strong> = The color you want the progress
bar to be: 1 = Red, 2 = Green, 3 = Blue (defaults to 2)<br>
<strong><font color=#008000>min</font></strong> = The value to be considered 0% (defaults
to 0)<br>
<strong><font color=#008000>max</font></strong> = The value to be considered 100%
(defaults to 100)<br>
<strong><font color=#008000>percentage</font></strong> = The percentage complete based
on the current value assigned (defaults to 0)<br>
<strong><font color=#008000>showpercentage</font></strong> = Whether the percentage
should be displayed to the user (defaults to .F.; best used when solidbar is .T.)<br>
<strong><font color=#008000>solidbar</font></strong> = Whether progress bar should
be shown as a solid as opposed to blocks (defaults to .F.)<br>
<strong><font color=#008000>value</font></strong> = The current value of the progress
(defaults to 0; should fall within the min and max range)
</p>
<p>
<strong>Other development notes<br>
</strong>The gradient look of the progress bar was created by dynamically adding lines
of varying degrees of color. The percentage showing through the progress bar was facilitated
by setting the drawmode property of the lines to 14 - Merge Pen Not.
</p>
<p>
<strong>Download the project<br>
</strong>You can either run the progressbarex.exe or you can open the project and
run the example.scx. Everything is included in the download. Here is the download
link and a screen shot of the included example...<br>
<br>
<a href="http://www.sweetpotatosoftware.com/files/progressbarex.zip">Download ProgressbarEx
Example and Source</a> (26 KB approx.)
</p>
<img src="http://www.sweetpotatosoftware.com/SPSBlog/content/binary/progressbarex.gif" border=0>
<br>
<hr>
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,87d20512-82d6-4ab2-827f-13a1bb5bbbf4.aspx">This post originally appeared on an external website</a></div>

Collapse -

SPS Weblog Upgraded

by craig In reply to The SPS Weblog

<p>
Well, not too long ago I posted an entry saying that I had upgraded to the latest
release of dasBlog, but then shortly after that they came out with another new version.
I was late to upgrade the last time, and instead of getting behind again, I downloaded <a href="http://www.hanselman.com/blog/DasBlog18Gold.aspx">dasBlog
1.8 Gold</a> (version 1.8.5223.0) today and set about the job of upgrading my
blog once again.
</p>
<p>
The upgrade wasn't quite as smooth this time as it was last time, but I did finally
get everything figured out after about an hour (most of the problems I experience
in upgrading have to do with bringing forward custom modifications I've made, not
necessarily that there is anything inherently wrong with the dasBlog upgrade process).
I haven't had an opportunity to go through everything yet, but I'm trusting it's operational
given the fact that they put "Gold" in the name of the version. The number one thing
I liked about this upgrade was that it got rid of the Spam trackbacks I was seeing
from all those online casinos.<br>
<br>
I'm a big fan of dasBlog and have been very pleased with their product so far.
</p>
<br />
<hr />
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,91e8b7f3-355a-4a43-87a9-4d3ff6ba4980.aspx">This post originally appeared on an external website</a></div>

Collapse -

Andrew MacNeill on Screencasting

by craig In reply to The SPS Weblog

<p>
I've just finished reading a wonderful article on creating screencasts by Andrew MacNeill
-- "<a href="http://www.aksel.com/whitepapers/ShowItAndsupportit.htm">Show It and
Support It</a>". Information regarding Windows Media Encoder, Windows Movie Maker,
Microsoft Producer, Automation of SnagIt in Visual FoxPro, and Camtasia Studio (my
personal favorite) is included.
</p>
<p>
Andrew says that the article was originally slated for FoxPro Advisor, but missed
the cut. I can understand why FoxPro Advisor passed on the article given the material
is not specifically targetting Visual FoxPro developers, but this is definitely a
worthwhile article for Visual FoxPro developers to read. Nothing explains or sells
a product like a screencast. And, if you are an independent developer, you may find
by knowing how to screencast effectively you can provide another beneficial service
to your clients.
</p>
<p>
Thanks for the great article Andrew!
</p>
<br />
<hr />
This weblog is sponsored by <a href="http://www.sweetpotatosoftware.com">SweetPotato
Software, Inc.</a><p><div class="blogdisclaim"><a href="http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,1f2c6632-536e-4552-a8a6-de8328ca0ff9.aspx">This post originally appeared on an external website</a></div>

Back to After Hours Forum
94 total posts (Page 3 of 10)   Prev   01 | 02 | 03 | 04 | 05   Next

Related Discussions

Related Forums