[futurebasic] Re: [FB] Automatic Date format

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2011 : Group Archive : Group : All Groups

From: Brian S <fblistserve@...>
Date: Wed, 16 Mar 2011 11:00:56 -0700
On Mar 16, 2011, at 10:07 AM, Peter wrote:

> Hi Brian,
> I've tried that but can't get the info into a variable
> I thought it would be:- variable = Fn ButtonTextString$(_field) but that doesn't work variable just ends up blank.
> Also I need to load previous files in and show the date from that file, and all I get is today's date.

This shows how to retrieve the date from the date/time control.

'--------------
local fn GetControlClockDate ( c as ControlRef, outDate as ^LongDateRec )
'~'1
dim as SInt32           buf
dim as LongDateRec      controlLongDate
dim as OSStatus         err

long if fn GetControlDataSize( c, _kControlEditTextPart, _kControlClockLongDateTag, buf ) == _noErr
err = fn GetControlData( c, _kControlEditTextPart, _kControlClockLongDateTag, sizeof(LongDateRec), @controlLongDate, buf )
if ( err == _noErr ) then BlockMoveData( @controlLongDate, outDate, sizeof(LongDateRec) ) // send data back to caller
end if
end fn


dim as Rect               r
dim as LongDateRec        cDate

appearance window -1,"Show Date Control"

SetRect( r, 208, 146, 320, 166 )
appearance button 1,, _kControlClockNoFlags,,,, @r, _kControlClockDateProc

window 1

fn GetControlClockDate ( button&( 1 ), @cDate )
print "month = ";cDate.ld.month 
print "day = ";cDate.ld.day
print "Year = ";cDate.ld.year

RunApplicationEventLoop()
'--------------

Brian S