Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

Rino Veryser



  • DateSerial in VFP

    Hi,

    Updated version of DATESERIAL in VFP (thanks to Sietse Wijnker)!

    Try this:

    Functionality differs in the passing of negative numbers as the days parameters. Other than that, it's the same but much, much less code

    FUNCTION _DateSerial(tnYear, tnMonth, tnDay)
    IF NOT BETWEEN(tnYear, 100, 9999)
    RETURN .NULL.
    ENDIF
    *- Create a base date. Jan 1st in the passed year
    ldDate = DATE(tnYear, 1, 1)
    *- Add the amount of months to the base-date. If the tnMont is negative, the nr of months will be subtracted
    ldDate = GOMONTH(ldDate, (tnMonth - 1))
    *- Add the nr of days. Negative nr of days will subtract
    ldDate = ldDate + (tnDay - 1)
    *- Return the date (DD.MM.YYYY)
    RETURN TRANSFORM(DAY(ldDate)) + "." + TRANSFORM(MONTH(ldDate)) + "." + TRANSFORM(YEAR(ldDate))
    ENDFUNC
  • Sniff your MSXML parser

    I like XML and I like VFP! So, I was very excited about the new possibilities in the new versions of VFP concerning XML.

    But when I installed my application on a client computer, the great function XMLTOCURSOR() didn't work!!!

    To use the Visual FoxPro OLE DB Provider with XMLTOCURSOR( ), you must install MSXML 3.0 on the computer with the OLE DB Provider.

    To sniff your MSXML parser on your computer, you can check this out at the following website: http://www.topxml.com/parsers/sniffer

    It requires IE6+, and I tried it with Firefox, but it doesn't work with Firefox

  • Detect Right-Click in an ActiveX Treeview Control

    My goal was to display a context-sensitive menu in response to a right-click on a treeview node, but I had a lot of problems getting there.

    Initially, I put code in the MouseDown() event, because that has automatic access to which button was clicked. When the event fires, it receives four parameters, the first of which is 1 for the left mouse button or 2 for the right mouse button.

    Unfortunately, at that moment, the tree's SelectedItem property still referred to the previously selected node, not the one on which I was right-clicking.

    I had heard that the MouseUp() event was the correct one for detecting a right-click action, and indeed, it has the same four parameters as MouseDown(), so I moved my code into that method. But now the event didn't fire, and my code didn't run at all. I put WAIT WINDOW commands in the MouseUp() and MouseDown() events to try to figure out where things were failing, and suddenly things started working; I now got the correct node with a right-click. When I removed all my debugging statements, leaving only code in the MouseUp() as before, the event once again failed to fire.

    From my trials, it seems that MouseUp() only fires if there's some code in the MouseDown() event. This is the working solution I came up with:

    * MouseDown event
    LPARAMETERS nButton, nShift, nXCoord, nYCoord
    Dummy = 0

    * MouseUp event
    LPARAMETERS nButton, nShift, nXCoord, nYCoord

    ClickedKey = this.SelectedItem.Key
    DO CASE
      CASE nButton = 1 && Left Click
        ** processing steps>

       CASE nButton = 2 && Right Click
        DO RightClickMenu.mpr
    ENDCASE

    I don't use the NodeClick event anymore, all mouse click-coding happens in the MouseUp() event.

This Blog

Post Calendar

<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

Post Categories

Syndication