1

Konu: FoxyClasses issue

Hello:

I am new here. Registered by using a good Internet dictionary. Worked well.

I created a form and put a FoxyClass instance of Datepick on it. It seems to work okay, except that when I run the form and click on the calendar button, nothing happens.

Now, when I put a valid date in the date section, and I click on the calendar button, it works. But I assume it should work also before I put any date at all in the date section?!

Also, I cannot put a date later than today's date using the calendar. I assume this has something to do with the fact that the button does not work as intended with my setup. What could I have done wrong?

Regards,

Hans L

2

Re: FoxyClasses issue

Welcome Hans,
It works just by clicking w/o any value. It doesn't let you to enter any date later than today because its default cb_maxdate value is =date() (use cb_mindate and cb_maxdate properties to specify allowable range).

I suggest you to use dtControl class instead (and PeriodPick for ranges). Other controls are the older ones that I even forgot how to use. With dtControl you can either use with or without a ControlSource (use Custom ControlSource if you need). It has ControlType setting:
1 - Datetime (default)
2 - Date
3 - Time (character 8)

Here is a sample form (in code to be able to send here) that use all types and with/without controlsource:

Visual Fox Pro
Public oForm

oForm = Createobject('SampleForm')
oForm.Show()
 
Define Class SampleForm As Form
  DataSession=2
  Height=320
  Width=400
 
  Add Object dt1 As dt With ;
    left=10,Top= 10,ControlSource='test.BirthDate',ControlType=2
  Add Object dt2 As dt With ;
    left=10,Top= 60,ControlSource='test.LastSeen'
  Add Object dt3 As dt With ;
    left=10,Top=110,ControlSource='test.SleepAt',ControlType=3
 
 
  Add Object dt4 As dt With Left=10,Top=160,ControlType=2,Value=Date()
  Add Object dt5 As dt With Left=10,Top=210,Value=Datetime()
  Add Object dt6 As dt With Left=10,Top=260,ControlType=3,Value='10:00 AM'
 
  Add Object cmdNext As CommandButton With Left = 250,Top=10,Caption='Next'
  Add Object cmdPrev As CommandButton With Left = 250,Top=60,Caption='Previous'
  Add Object cmdBrowse As CommandButton With Left = 250,Top=110,Caption='Browse'
  Add Object cmdValues As CommandButton With Left = 250,Top=160,Caption='Get Values'
 
 
  Procedure Load
    Set Seconds Off
    Set Century On
    Create Cursor test (BirthDate d, LastSeen T, SleepAt c(8))
    Insert Into test Values (Date(1961,1,19), Datetime(2009,8,14,10,30), '02:10 AM')
    Insert Into test Values (Date(1990,6,28), Datetime(2009,8,14,11,30), '22:30')
    Insert Into test Values ({},{},'')
    Locate
  Endproc
 
  Procedure cmdNext.Click
    Select test
    If !Eof()
      Skip
      If Eof()
        Go Bottom
      Endif
    Endif
    Thisform.Refresh()
  Endproc
 
  Procedure cmdPrev.Click
    Select test
    If !Bof()
      Skip -1
      If Bof()
        Go Top
      Endif
    Endif
    Thisform.Refresh()
  Endproc
 
  Procedure cmdBrowse.Click
    Select test
    Browse
  Endproc
 
  Procedure cmdValues.Click
    Local lcValues, ix, loControl
    lcValues = ''
    Set Textmerge To Memvar m.lcValues Noshow
    Set Textmerge On
    For ix = 1 To 6
      loControl = Evaluate('thisform.dt'+Ltrim(Str(m.ix)))
\dt<<m.ix>> [<<TYPE('loControl.Value')>>] : <<loControl.value>>
    Endfor
    Set Textmerge To
    Set Textmerge Off
    Messagebox(m.lcValues)
  Endproc
 
 
Enddefine
 
Define Class dt As dtControl Of ('d:\foxyclasses\classes\datetimectrls.vcx')
Enddefine

3

Re: FoxyClasses issue

Thank you for the 'Welcome', Cetin, and for your reply.

Just to be absolutely sure:

-  Do NOT use Datepick1, Timepick1, Datetimepick1, and PeriodPicker1 (without "First Day OF Week").

-  Do USE Dtcontrol1 and Periodselector1 (with "First Day OF Week").

Correct?


Now, in the same class library are the two following classes:

-  Dttextbox1
-  Edtexpand1

Seems a little strange that they are in this library, but ...  Should they be used?

Best regards,

Hans L

4

Re: FoxyClasses issue

Oh sorry for the confusion:
Use:
PeriodPicker (no FDOW combo)
DtControl

Do not use rest. dtTextbox  should be there because it was used in those date*Pick controls. edtExpand being there is an artifact. I should have copied it while doing some other work and forgot to remove.

5

Re: FoxyClasses issue

Okay, Cetin, all clear now.

Regards,

Hans L

6

Re: FoxyClasses issue

Since I named this thread "Foxy Classes issues", I assume it is appropriate to continue bringing up issues here.

In classlibrary Grids, there are the following classes:

-  locatorgrid
-  multiselectgrid
-  editgrid
-  superbase
-  highlighted
-  locatortextbox
-  multiselgrdtxtbox
-  multiselgrdchkbox
-  grdcheckbox
-  locgrdtimer

I guess that only a few of these are to be put on a form by the developer (which ones?) and that the others are "help" classes for the "form" classes. If so, the "help" classes can safely be removed from the "View Classes" menu of the "Control Toolbar", or ...?

Regards,

Hans L

7

Re: FoxyClasses issue

In class library Global, there are Smarttextbox1 and Edtexpand1, but also Cmbself_edit. What is this latter class?

Regards,

Hans L

8

Re: FoxyClasses issue

Latter class is a bonus class:) What it does is to create a combobox that adds items to itself automatically. Suppose you have a field called City and no records in your table yet. You can have a cmbSelf_edit whose controsurce is that field and also set its properties so it populates itself from that field (might be another table field too but genrally the same field as the controlsoruce). Initially it has nothing in dropwdown and you simply type  a new city. Next time you have that city. Cities added as you introduce new ones. It is old poor man's autocomplete combobox in other words (think it was created during VFP5 days). Later I created SmartTextBox and I prefer that over cmbSelf_edit and VFP's autocomplete.