HMG Tutorials & Tips

Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
  1. One of my replies got lost on the way to the board,

    I always looked for the error inside the main function.

    @ edk: Thank you.

    @ Mustafa: edk's reply showed me the difference.

    Thx again.

    Robert

    Statistics: Posted by ROBROS — Thu May 10, 2018 4:21 pm


  2. *------------------ Your code -------------------*
    #include "hmg.ch"

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

    FUNCTION Main()

    local cDat, cDatum

    DEFINE WINDOW Date_1 ;
    .....
    *----------------- My code ------------------------*

    #include "hmg.ch"

    FUNCTION Main()

    local cDat, cDatum

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

    DEFINE WINDOW Date_1 ;
    ....

    Statistics: Posted by mustafa — Thu May 10, 2018 2:29 pm


  3. your code with arrangement

    CODE:

    #include "hmg.ch"FUNCTION Main()local cDat, cDatumset century onset date to germanset date format to "DD.MM.YYYY" DEFINE WINDOW Date_1 ; AT 120,120 ; WIDTH 400 ; HEIGHT 150 ; TITLE "Textbox Date" ; MAIN  END WINDOW  On Key F10 of date_1 action showdat()  @ 50,50 LABEL datum ; PARENT Date_1 ; VALUE "Datum" ; @ 50,160 TEXTBOX date ;   PARENT Date_1 ;   WIDTH 120 ;   HEIGHT 30 ;   date    inputmask "99.99.9999"    VALUE Date()     ACTIVATE WINDOW Date_1 RETURN NIL  function showdat cDat:=dtoc(Date_1.date.value) cDatum:=right(cDat,4)+substr(cDat,4,2)+left(cDat,2)  MsgInfo(cDat) MsgInfo(cDatum)return
    Regards
    Mustafa

    Statistics: Posted by mustafa — Thu May 10, 2018 2:23 pm


  4. Hi friend Mustafa,

    I compiled and of course it works, thank you, but I have not yet found the difference to my code.;)

    Anyway: Thank you
    Robert

    Statistics: Posted by ROBROS — Thu May 10, 2018 2:16 pm


  5. Hi friends,
    I played around with a date-type textbox and need help. See the code:

    CODE:

    #include "hmg.ch"set century onset date to germanset date format to "DD.MM.YYYY"FUNCTION Main()local cDat, cDatum DEFINE WINDOW Date_1 ; AT 120,120 ; WIDTH 400 ; HEIGHT 150 ; TITLE "Textbox Date" ; MAIN  END WINDOW  On Key F10 of date_1 action showdat()  @ 50,50 LABEL datum ; PARENT Date_1 ; VALUE "Datum" ; @ 50,160 TEXTBOX date ;   PARENT Date_1 ;   WIDTH 120 ;   HEIGHT 30 ;   date    inputmask "99.99.9999"    VALUE Date()    ACTIVATE WINDOW Date_1 RETURN NIL  function showdat cDat:=dtoc(Date_1.date.value) cDatum:=right(cDat,4)+substr(cDat,4,2)+left(cDat,2)  MsgInfo(cDat) MsgInfo(cDatum)return
    It seems inputmask does not work with date-textbox, and the date format setting is ignored too.
    Btw: Why do I not get a syntax error because of the semicolon at value of label datum and why do I get a syntax error at the date statement in textbox?

    Thank you for your help

    Robert

    PS: How can I append a screenshot to show you the result of my code?
    Wrong syntax of TextBox. When you define a TextBox with the DATE option, you can not use INPUTMASK.
    Also, you must set century and date format locate in to FUNCTION Main(), not before.

    CODE:

    #include "hmg.ch"FUNCTION Main()local cDat, cDatumset century onset date to germanset date format to "DD.MM.YYYY" DEFINE WINDOW Date_1 ; AT 120,120 ; WIDTH 400 ; HEIGHT 150 ; TITLE "Textbox Date" ; MAIN  END WINDOW  On Key F10 of date_1 action showdat()  @ 50,50 LABEL datum ; PARENT Date_1 ; VALUE "Datum" ; @ 50,160 TEXTBOX date ;   PARENT Date_1 ;   WIDTH 120 ;   HEIGHT 30 ;   VALUE Date();   DATE    ACTIVATE WINDOW Date_1 RETURN NIL  function showdat cDat:=dtoc(Date_1.date.value) cDatum:=right(cDat,4)+substr(cDat,4,2)+left(cDat,2)  MsgInfo(cDat) MsgInfo(cDatum)return

    Statistics: Posted by edk — Thu May 10, 2018 2:02 pm