HMG Tutorials & Tips

Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
  1. http://www.hmgforum.com/viewtopic.php?f... dar#p30980

    Statistics: Posted by andyglezl — Tue Dec 11, 2018 7:46 pm


  2. Hi Edward,
    thank you once again, this is surely for reasons of compatibility.

    Robert

    Statistics: Posted by ROBROS — Sun Sep 16, 2018 6:54 pm


  3. Most controls have two syntax, one standard syntax - xBase style (one line record , then semicolons are required for multi-line entries - they start with @) or alternate (multi-line entries without semicolons - they are saved as definitions DEFINE control... END control). See HMG reference : http://hmgforum.com/hmgdoc/data/label.htm

    Statistics: Posted by edk — Sun Sep 16, 2018 6:43 pm


  4. Hi friends,
    still playing around with dates, once again I found a strange behaviour (at least in my opinion) of the compiler: I use IDE "RUN" to compile. It has to do with the semicolon, telling the compiler, that the following line is not a new line, but the previous one is continued.

    How do I know, if a new line in source code is requested? Please see attached source code.

    CODE:

    #include "hmg.ch"FUNCTION Main()local cDat, cDatumcName:=GetComputerName()set language to germanset century onset date to germanset date format to "DD.MM.YYYY" set navigation extended//MsgInfo('Computer-Name: '+ cName)************* DEFINE WINDOW Date_1 ;  AT 120,120 ;  WIDTH 600 ;  HEIGHT 400 ;  FONT 'ARIAL' Size 14 ;  TITLE "Wochentag eines Datums" ;  MAIN  END WINDOW  On Key F10 of date_1 action showdat() //Why no semicolons necessary in the following labels? **************************************************************** DEFINE LABEL datum_0  PARENT Date_1   ROW 40   COL 10   width 300  height 50  FONTNAME 'ARIAL'   FONTSIZE 12  autosize .T. VALUE "Find out the CDOW() of a date"  END LABEL    DEFINE LABEL datum   PARENT Date_1   ROW 150  COL 10   width 300  height 50  FONTNAME 'ARIAL'   FONTSIZE 12  autosize .T.  VALUE "Enter date,go on with RETURN or F-10"  END LABEL    @ 200,10 TEXTBOX date ;   PARENT Date_1 ;   WIDTH 120 ;   HEIGHT 30 ;   Font 'ARIAL' SIZE 14 ;   value nil ;     date  ;   On Enter showdat()           DEFINE BUTTON showdat            PARENT date_1            ROW 200             COL 140            CAPTION 'F-10'              ONCLICK showdat()Fontname 'ARIAL'FontSize 14            WIDTH 60             HEIGHT 30      END BUTTON       ACTIVATE WINDOW Date_1 RETURN NIL ***************************************************** //CDOW() is shown in German. :-)  function showdat cDat:=dtos(Date_1.date.value) cDatum:=dtoc(Date_1.date.value)  if empty(cDat)MsgInfo('No valid date') else//MsgInfo(cDat)//MsgInfo(cDatum) MsgInfo(cDatum+' = '+cdow(Date_1.date.value)) endif Date_1.releasereturn
    Maybe someone can explain that to me (retiring in 2 weeks) but working on with hmg to keep my brains alive.

    Robert

    How can I remove the previous post, bbcode was wrong.

    Statistics: Posted by ROBROS — Sun Sep 16, 2018 4:43 pm


  5. This post should be removed, the following post is identical, the only difference is, that bbcode is ok. :lol:

    Hi friends,
    still playing around with dates, once again I found a strange behaviour (at least in my opinion) of the compiler: I use IDE "RUN" to compile. It has to do with the semicolon, telling the compiler, that the following line is not a new line, but the previous one is continued.

    How do I know, if a new line in source code is requested? Please see attached source code.

    [code)#include "hmg.ch"

    FUNCTION Main()

    local cDat, cDatum
    cName:=GetComputerName()

    set language to german
    set century on
    set date to german
    set date format to "DD.MM.YYYY"
    set navigation extended

    //MsgInfo('Computer-Name: '+ cName)
    *************

    DEFINE WINDOW Date_1 ;
    AT 120,120 ;
    WIDTH 600 ;
    HEIGHT 400 ;
    FONT 'ARIAL' Size 14 ;
    TITLE "Wochentag eines Datums" ;
    MAIN
    END WINDOW

    On Key F10 of date_1 action showdat()


    //Why no semicolons necessary in the followin labels?
    ****************************************************************
    DEFINE LABEL datum_0
    PARENT Date_1
    ROW 40
    COL 10
    width 300
    height 50
    FONTNAME 'ARIAL'
    FONTSIZE 12
    autosize .T.
    VALUE "Find out the CDOW() of a date"
    END LABEL

    DEFINE LABEL datum
    PARENT Date_1
    ROW 150
    COL 10
    width 300
    height 50
    FONTNAME 'ARIAL'
    FONTSIZE 12
    autosize .T.
    VALUE "Enter date,go on with RETURN or F-10"
    END LABEL

    @ 200,10 TEXTBOX date ;
    PARENT Date_1 ;
    WIDTH 120 ;
    HEIGHT 30 ;
    Font 'ARIAL' SIZE 14 ;
    value nil ;
    date ;
    On Enter showdat()

    DEFINE BUTTON showdat
    PARENT date_1
    ROW 200
    COL 140
    CAPTION 'F-10'
    ONCLICK showdat()
    Fontname 'ARIAL'
    FontSize 14
    WIDTH 60
    HEIGHT 30
    END BUTTON


    ACTIVATE WINDOW Date_1
    RETURN NIL
    *****************************************************
    //CDOW() is shown in German. :-)

    function showdat
    cDat:=dtos(Date_1.date.value)
    cDatum:=dtoc(Date_1.date.value)

    if empty(cDat)
    MsgInfo('No valid date')
    else
    //MsgInfo(cDat)
    //MsgInfo(cDatum)
    MsgInfo(cDatum+' = '+cdow(Date_1.date.value))
    endif
    Date_1.release
    return [/code]

    Maybe someone can explain that to me (retiring in 2 weeks) but working on with hmg to keep my brains alive.

    Robert

    Statistics: Posted by ROBROS — Sun Sep 16, 2018 4:41 pm