Alpha Video Training
Results 1 to 7 of 7

Thread: Spin Control for Date field - Help!

  1. #1
    Rob Schippers
    Guest

    Default Spin Control for Date field - Help!


    Anyone know how to do this in A5 4.5 - I'm just starting to convert from A5 V1.

    I used to have a date field in A5 v1 where I had placed an up and down button next to it with code in it as follows:

    if db_mode_get(db_current())=0 then
    end
    end if
    if isblank("timesht2->date")then
    timesht2->date = previous("timesht2->date")+1
    else
    timesht2->date = TIMESHT2->DATE+1
    end if
    card_resynch()

    This worked in both change and enter modes.


    Having converted this form to A5 v4.5 this did not work any more. If I hit my button in view mode, nothing happened. If I hit it while entering a new record, it popped me back to an existing record. I got it to work in view mode - which is now the same as change mode??? by editing it as follows.

    if isblank("timesht2->date")then

    :data_entry:tables:timesht2.change_begin(honor_field_rules)
    :data_entry:tables:timesht2.date = previous("timesht2->date")+1
    :data_entry:tables:timesht2.change_end()

    else
    :data_entry:tables:timesht2.change_begin(honor_field_rules)
    :data_entry:tables:timesht2.date = data_entry:tables:timesht2.date + 1
    :data_entry:tables:timesht2.change_end()
    end if

    card_resynch()

    But I have not succeeded to get it to work in enter mode. This obviously requires different code??




    I tried the built-in smart-field spin control also. Whole new adventure!!!

    First I tried pasting the sample code into the forms init event. This code would dissappear every time i closed the window.

    I finally added a command to the init event, this made it go black. Then I converted the command to x-basic, then edited the code, then replaced it with the spin-control code, then it worked.

    Except it increments only the day number in the date field and not the entire date.





    Where does one find info to get started with the new code editor, and how to modify the content of fields with xbasic?? for example I searched for change_begin in help, and it did not even show up??

    I think I need to know how to determine in code if the form is in edit or enter mode??

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Spin Control for Date field - Help!

    The books by Dr. Wayne, available from Alpha Software, are good places to start.

    The Xbasic Reference Manual is a useful resource, but it's more of a reference book than a tutorial or teaching aid.

    What's an 'up and down' button ?

    -- tom

  3. #3
    Rob Schippers
    Guest

    Default RE: Spin Control for Date field - Help!


    My buttons look something like this:


    [ field ][^][v]



    (Two small square buttons next to the field with ^ and v text in them to show up and down.)

    The script to edit the field is in the buttons

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Spin Control for Date field - Help!

    Here's an example, showing one way to implement this kind of thing in Version 4. I've tried to heavily comment the scripts, but don't hesitate to ask questions if something isn't clear.

    Unzip the attachment to a separate folder. Do not mix with your development work

    -- tom

  5. #5
    Rob Schippers
    Guest

    Default RE: Spin Control for Date field - Help!

    Thank you for that.

    It worked fine, then I put my card_resynch() back in, which was there to update another field on the form, then it stopped working again!

    So the problem was the resynch itself.

    Now I just need to find another way to update the secondary field - that should be easy enough.

    I have yet to find how to determine if the form is in data-entry mode, so I can make the code different for that.

  6. #6
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Spin Control for Date field - Help!

    Spend some time in ch. 12 of the xbasic Ref. Manual. You'll find the parentform.mode_get() command explained.

    -- tom

  7. #7
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Spin Control for Date field - Help!

    Also take a look at the .resynch() command and the .refresh() command under Xbasic Methods for Working with Forms and Browses.

Similar Threads

  1. Spin Button Properties
    By Howard G. Cornett in forum Alpha Five Version 6
    Replies: 4
    Last Post: 12-21-2004, 08:56 AM
  2. Any Spin Doctors in the house?
    By G Gabriel in forum Alpha Five Version 6
    Replies: 7
    Last Post: 12-07-2004, 01:14 PM
  3. Spin Control Increment
    By Scott Emerick in forum Alpha Five Version 5
    Replies: 4
    Last Post: 07-18-2003, 05:56 AM
  4. Spin Box
    By Dorothy in forum Alpha Five Version 4
    Replies: 6
    Last Post: 06-22-2001, 01:33 PM
  5. lou@spin.net.au
    By Louis Viaggio in forum Alpha Five Version 4
    Replies: 4
    Last Post: 07-11-2000, 12:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •