Alpha Video Training
Results 1 to 4 of 4

Thread: Help with Killfocus event and %code% logic

  1. #1
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    786

    Default Help with Killfocus event and %code% logic

    Trying to get the killfocus event to work on several variables.

    vDateEvent works ... converts vDate to date format

    vLocationEvent.. don't allow a blank value in vLocation

    vLogEvent creates filename from input variables and saves vLogdata

    I cannot see how to get the "OK" & "cancel" to be used with the other codings

    getting my conditions muddled somewhere in the %code" section, but cannot see it.

    Can anyone please tell me where I am going wrong?

    Code:
    DIM form_name as C
    if is_object(topparent.this) then
        form_name = topparent.name()+".this"
    else
        form_name = ""
    end if
    DIM SHARED vDate as D
    DIM SHARED vPlaceNo as C = "01"
    DIM SHARED vLocation as C
    DIM SHARED vLogData as C
    DIM SHARED varC_result as C
    DELETE expression_result
    expression_result = eval("date()",form_name)
    vDate = convert_type(expression_result,"D")
    DIM vLocation_def as C
    vLocation_def = "ke=logging_where,{keylist_build(\"H=.05,1:25\",''+where,left(''+where,25))}{}"
    varC_result = ui_dlg_box("Enter Logging",<<%dlg%
    {Background=#153+204+255}
    {region}
    Date:| [%DATE;P=popup.calendar(dtoc(vDate));I=popup.calendar%.16vDate!vDateEvent_*];
    Place Number:| [.3vPlaceNo];
    Location:| [%@vLocation_def%.40vLocation!vLocationEvent_*];
    Log:| [%mw%.40,12vLogData!vLogEvent_*];
    {endregion};
    {line=1,0};
    {region}
    <*10OK!OK> <10Cancel!CANCEL>
    {endregion};
    %dlg%,<<%code%
    if a_dlg_button = "OK" .or. a_dlg_button = "CANCEL" then
        'do nothing - the dialog will close
    elseif left(a_dlg_button,11) = "vDateEvent_" then
        if a_dlg_button = "vDateEvent_killfocus" then
            vDate = ctod(dtoc(vDate))
        end if
        a_dlg_button = ""
    elseif left(a_dlg_button,15) = "vLocationEvent_" then
        if a_dlg_button = "vLocationEvent_killfocus" then
            if vLocation = "" then
                ui_msg_box("error","Location Required")
                a_dlg_button = ""
            else
                vLocation = upper(vLocation)
                a_dlg_button = ""
            end if
        end if
        a_dlg_button = ""
    elseif left(a_dlg_button,10) = "vLogEvent_" then
        if a_dlg_button = "vLogEvent_Killfocus" then
            header_text = "#"-dtoc(vDate)-"|"-vPlaceNo-"|"-vLocation
            vLogFileData = upper(header_text+crlf()+vLogdata)
    '        dim st as Y
    '        st = now()
    '        ctimestamp = left(cshorttime(st),4)
    '        cDatestamp = dtos(vDate)
    '        vLogFileName = filename_decode("[logPath]\\"+remspecial(rtrim(vLocation))+cDatestamp+"@"+ctimestamp+".log")
    '        showvar(vLogfileName)
    '        save_to_file(vLogFileData,vLogFileName)
            a_dlg_button = ""
        end if
        a_dlg_button = ""
    else
        a_dlg_button = ""
    end if
    %code%)
    if varC_result = "OK" then
        showvar(vLogFileData)
    end if
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

  2. #2
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,581

    Default Re: Help with Killfocus event and %code% logic

    I looked at this kind of quickly and found that the cursor would not stop in the location field.
    I removed the @ symbol and it appears to be working.

    Location:| [%@vLocation_def%.40vLocation!vLocationEvent_*];
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  3. #3
    "Certified" Alphaholic Ronald Anusiewicz's Avatar
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,581

    Default Re: Help with Killfocus event and %code% logic

    Add the code in red to have the cursor return to that field.

    if vLocation = "" then
    ui_msg_box("error","Location Required")
    UI_DLG_CTL_GOTO("Enter Logging","[%vLocation_def%.40vLocation!vLocationEvent_*]")
    a_dlg_button = ""
    else
    vLocation = upper(vLocation)
    a_dlg_button = ""
    end if
    Alpha Anywhere v3.5
    Version 12.3, Build 2999
    MySql56 & DBF's

    Alpha 4, 5, Anywhere

    Ron Anusiewicz

  4. #4
    Member Graham Wickens's Avatar
    Real Name
    Graham Wickens
    Join Date
    Apr 2000
    Location
    Gloucestershire, UK
    Posts
    786

    Default Re: Help with Killfocus event and %code% logic

    Thanks Ron,
    think I have all bases covered now, UI_DLG_CTL_GOTO is a new one to me :)
    but it only worked for me as ui_dlg_ctl_goto("Enter Logging","vLocationEvent")
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

Similar Threads

  1. No xdialog killfocus event for combo box
    By Mike Wilson in forum Alpha Five Version 10 - Desktop Applications
    Replies: 35
    Last Post: 11-11-2012, 04:15 PM
  2. what's the wrong logic in this code that has worked for years but now doesn't?
    By Mike Wilson in forum Alpha Five Version 10 - Desktop Applications
    Replies: 10
    Last Post: 06-28-2011, 05:00 AM
  3. x_dialog Killfocus event
    By Tom Henkel in forum Alpha Five Version 9 - Desktop Applications
    Replies: 16
    Last Post: 05-10-2010, 12:13 PM
  4. onwrotefield field event logic error
    By Bob Arbuthnot in forum Alpha Five Version 8
    Replies: 11
    Last Post: 05-23-2007, 01:01 AM
  5. Xdialog killfocus event
    By Mario Prieto in forum Alpha Five Version 5
    Replies: 9
    Last Post: 09-01-2003, 08:41 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
  •