Page 8 of 10

Re: Questions of zero level

Posted: Sat Jun 02, 2012 1:52 am
by Eugene Lutsenko
I thank.

What additional possibilities are provided by DC_GuiDbEdit() in comparison with DC_DbEdit()?

I didn't find examples of application of DC_GuiDbEdit() and documentation on this function.

Re: Questions of zero level

Posted: Mon Jun 04, 2012 9:23 pm
by Eugene Lutsenko
Dear Roger!

I try to use function DC_GuiDbEdit(). I ask you if it is possible, to inform me names of the variables which values are transferred in the user function: FUNCTION MyFunc1_2(nMode, nColPos). With variables nMode, nColPos something it is impossible to work.

Couldn't result the elementary example of application DC_GuiDbEdit () with the user function providing editing of values of fields of a database.

Re: Questions of zero level

Posted: Tue Jun 05, 2012 1:45 pm
by rdonnay
I think you are the first person ever to use this function in the 12 years that eXpress++ has been used. I don't even know why I wrote that. I think I did it when I was first learning Xbase++.

Why don't you use @..DCBROWSE to create a browse system?

Re: Questions of zero level

Posted: Thu Jun 07, 2012 12:45 pm
by Eugene Lutsenko
But I it didn't know that. I look, it seems function as function, in sense normal by sight function. I think, and why it not to use? It seems also works well. Well there are questions, here and set. Now I will try that you advised.

Re: Questions of zero level

Posted: Sun Jun 10, 2012 11:09 am
by Eugene Lutsenko
rdonnay wrote:I think you are the first person ever to use this function in the 12 years that eXpress++ has been used. I don't even know why I wrote that. I think I did it when I was first learning Xbase++.

Why don't you use @..DCBROWSE to create a browse system?
Dear Roger!

I want you to thank for the program especially: xdemo.exe. By the way, Roger, the program xdemo.exe it also is precisely that I understood as "standard decisions".

I am absolutely sure that in the future as I will deal with that you created, at me more and more occasions will be grateful to you.

Re: Questions of zero level

Posted: Fri Jun 29, 2012 5:54 pm
by Eugene Lutsenko
On the basis of XSample_56 examples () and XSample_14 () xdemo.exe eXPress ++ developed function, for display of a stage of process with very exact adaptive forecasting of time of execution.

Type of a window of display of a stage of process and forecast of time of execution:

Image

At first it is necessary for use of this function:
- to declare variables;
- to define the top limit of number of events in process;
- to measure time of the beginning of process;
- to organize a display and progress-bar window.

Code: Select all

LOCAL GetList  := {}, oMainDlg
LOCAL oProgress, oDialog, lOk := .t., oButton, nEvent, mp1, mp2, oXbp
PUBLIC oSay1, oSay2, oSay3, oSay4, oSay5, oSay6, oSay7, oSay8, oSay9, oSay10, Mess98, Mess99

Code: Select all

   // Подготовка данных для отображения графического прогресс-бар

   // Определить значение Wsego
   DIRCHANGE(M_ApplsPath+"\OldAppls")    // Перейти в папку с БД старой модели
   CLOSE ALL
   USE Object   EXCLUSIVE NEW;N_Obj = RECCOUNT()
   USE Priz_ob  EXCLUSIVE NEW;N_Pro = RECCOUNT()
   USE Priz_per EXCLUSIVE NEW;N_Prp = RECCOUNT()
   USE ObInfZag EXCLUSIVE NEW;N_Zag = RECCOUNT()       // БД используется 2 раза
   USE ObInfKpr EXCLUSIVE NEW;N_Kpr = RECCOUNT()

   Wsego = N_Obj + N_Pro + N_Prp + 2*N_Zag + N_Kpr     // Задание максимальной величины параметра Time
   Time_Progress = 0

Code: Select all

     // Прошло секунд с начала процесса
   // Процесс может идти больше суток, поэтому для определения
   // во всех случаях вычисляется время, прошедшее с начала года

   T_Mess1 = "Начало: "+TIME()            // Начало
   Sec_1  = (DOY(DATE())-1)*86400+SECONDS()

Code: Select all

   // Отображение стадии исполнения. Будет написано прямо в окне Progress-bar
   @ 0,0 DCGROUP oGroup1 CAPTION 'Стадии исполнения процесса' FONT "6.Helv" SIZE 105,7.5 ;
         PARENT oTabPage1
   @ 9,0 DCGROUP oGroup2 CAPTION 'Прогноз времени исполнения' FONT "6.Helv" SIZE 105,5.5 ;
         PARENT oTabPage2
    s = 1
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay1 FONT "10.Helv"
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay2 FONT "10.Helv"
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay3 FONT "10.Helv"
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay4 FONT "10.Helv"
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay5 FONT "10.Helv"
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay6 FONT "10.Helv"
    s++
   @s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay7 FONT "10.HelvBold"
    s++
   @0.2+s++,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay98 FONT "8.Courier Bold" COLOR GRA_CLR_BLUE 
   @1.5+s  ,1 DCSAY "" SAYSIZE 100 SAYOBJECT oSay99 FONT "8.Courier Bold" COLOR GRA_CLR_BLUE

   @s  ,1 DCPROGRESS oProgress ;
          SIZE 95,1.5 ;
          PERCENT ;
          EVERY INT(Wsego/100) ;       // Кол-во обновлений изображения
          MAXCOUNT Wsego ;
          COLOR GRA_CLR_CYAN           // Цвет полосы
   @s++,97 DCPUSHBUTTON  CAPTION '&Cancel' ;
          ACTION {||lOk:=.f.} OBJECT oButton ;
          SIZE 7,1.5
   DCREAD GUI ;
          TITLE '5.1. Конвертер приложения из старого стандарта БД в новый' ;
          PARENT @oDialog ;
          FIT ;
          EXIT ;
          MODAL
   oDialog:show()
Then there are the cycles corresponding to stages or steps of execution of process with the address from a body of a cycle to offered function. One of such цаклов is brought below.

Code: Select all

   // Конвертирование БД классификационных шкал и градаций
   oSay1:SetCaption("Шаг 1-й из 6. Конвертирование БД классификационных шкал и градаций")
   CLOSE ALL
   DIRCHANGE(M_NewAppl)                  // Перейти в папку с БД новой модели
   USE Classes EXCLUSIVE;ZAP
   DIRCHANGE(M_ApplsPath+"\OldAppls")    // Перейти в папку с БД старой модели
   USE Object  EXCLUSIVE NEW
   DBGOTOP()
   DO WHILE .NOT. EOF()
      M_Kod  = Kod
      M_Name = Name
      DIRCHANGE(M_NewAppl)               // Перейти в папку с БД новой модели
      SELECT Classes
      APPEND BLANK
      REPLACE Kod_clas WITH M_Kod
      REPLACE Name     WITH M_Name
      DIRCHANGE(M_ApplsPath+"\OldAppls") // Перейти в папку с БД старой модели
      SELECT Object
      DBSKIP(1)
      Time_Progress (++Time_Progress, Wsego, oProgress, lOk )
   ENDDO
   oSay1:SetCaption(oSay1:caption+" - Готово ")
And at last initial code of the function:

Code: Select all

***********************************************************************************************************
****** Графический прогресс-бар (на основе примера XSample_14() xdemo.exe)
***********************************************************************************************************
STATIC FUNCTION Time_Progress (Time_Progress, Wsego, oProgress, lOk )

    LOCAL nMaxCount := Wsego

    x = Time_Progress

    ** Отображение занимает очень много времени, поэтому
    ** Если Wsego > 100
    ** показывать прогресс не для всех х, а только для таких,
    ** которые нацело делятся на Wsego/100
    IF x < 100 .OR. (x+1) = Wsego // Всегда показывать прогресс в начале и конце
    ELSE                          // и для малого числа событий: Wsego < 100
       Wsego100 = ROUND(Wsego/100,0)
       IF Wsego100 > 1 .AND. (x+1) <> Wsego100*INT((x+1)/Wsego100)
          RETURN NIL
       ENDIF
    ENDIF

    *** Индикация времени исполнения

    ***** Процесс может идти больше суток, поэтому для определения
    ***** во всех случаях вычисляется время, прошедшее с начала года
*   T_Mess1 = "Начало: "+TIME()            // Начало

    ***** Прошло секунд с начала процесса
    PUBLIC T_Mess2 := "ch:mi:se"
    Sec_2   = (DOY(DATE())-1)*86400+SECONDS() - Sec_1
    ch2 = INT(Sec_2/3600)                    && Часы
    mm2 = INT(Sec_2/60)-ch2*60               && Минуты
    cc2 = Sec_2-ch2*3600-mm2*60              && Секунды
    T_Mess2 = "Прошло: "+ALLTRIM(STRTRAN(T_Mess2,"ch",STR(ch2,15)))
    T_Mess2 = STRTRAN(T_Mess2,"mi",STRTRAN(STR(mm2,2)," ","0"))
    T_Mess2 = STRTRAN(T_Mess2,"se",STRTRAN(STR(cc2,2)," ","0"))
    *@19,2 SAY T_Mess2+" всего: "+ALLTRIM(STR(Sec_2,17))+" сек."

    PUBLIC T_Mess3 := "ch:mi:se"             // Осталось
    Sec_3 = Sec_2*Wsego/x                    && Прогн.длит.исп. в секундах
    ch3 = INT(Sec_3/3600)                    && Часы
    mm3 = INT(Sec_3/60)-ch3*60               && Минуты
    cc3 = Sec_3-ch3*3600-mm3*60              && Секунды
    T_Mess3 = ALLTRIM(STRTRAN(T_Mess3,"ch",STR(ch3,15)))
    T_Mess3 = STRTRAN(T_Mess3,"mi",STRTRAN(STR(mm3,2)," ","0"))
    T_Mess3 = STRTRAN(T_Mess3,"se",STRTRAN(STR(cc3,2)," ","0"))
    *@20,2 SAY T_Mess3+" всего: "+ALLTRIM(STR(Sec_3,17))+" сек."

    PUBLIC T_Mess4 := "ch:mi:se"             // Окончание
    Sec_4 = Sec_1 + Sec_3 - (DOY(DATE())-1)*86400
    ch4 = INT(Sec_4/3600)                    && Часы
    mm4 = INT(Sec_4/60)-ch4*60               && Минуты
    cc4 = Sec_4-ch4*3600-mm4*60              && Секунды
    T_Mess4 = "Окончание: "+ALLTRIM(STRTRAN(T_Mess4,"ch",STR(ch4,15)))
    T_Mess4 = STRTRAN(T_Mess4,"mi",STRTRAN(STR(mm4,2)," ","0"))
    T_Mess4 = STRTRAN(T_Mess4,"se",STRTRAN(STR(cc4,2)," ","0"))
    *@21,2 SAY T_Mess4+" всего: "+ALLTRIM(STR(Sec_4,17))+" сек.с нач.суток"

    PUBLIC T_Mess5 := "Средн.время обработки 1-го объекта: ch:mi:se"
    Sec_5 = Sec_2/x
    ch5 = INT(Sec_5/3600)                    && Часы
    mm5 = INT(Sec_5/60)-ch5*60               && Минуты
    cc5 = Sec_5-ch5*3600-mm5*60              && Секунды
    T_Mess5 = ALLTRIM(STRTRAN(T_Mess5,"ch",STR(ch5,15)))
    T_Mess5 = STRTRAN(T_Mess5,"mi",STRTRAN(STR(mm5,2)," ","0"))
    T_Mess5 = STRTRAN(T_Mess5,"se",STRTRAN(STR(cc5,2)," ","0"))
    *@22,2 SAY T_Mess5+" всего: "+ALLTRIM(STR(Sec_5,17))+" сек."

    PUBLIC T_Mess6 := "ch:mi:se"             // Осталось
    Sec_6 = Sec_3 - Sec_2
    ch6 = INT(Sec_6/3600)                    && Часы
    mm6 = INT(Sec_6/60)-ch6*60               && Минуты
    cc6 = Sec_6-ch6*3600-mm6*60              && Секунды
    T_Mess6 = "Осталось: "+ALLTRIM(STRTRAN(T_Mess6,"ch",STR(ch6,15)))
    T_Mess6 = STRTRAN(T_Mess6,"mi",STRTRAN(STR(mm6,2)," ","0"))
    T_Mess6 = STRTRAN(T_Mess6,"se",STRTRAN(STR(cc6,2)," ","0"))
    *@23,2 SAY T_Mess6+" всего: "+ALLTRIM(STR(Sec_6,17))+" сек."

    Mess98 = T_Mess1+SPACE(95-LEN(T_Mess1)-LEN(T_Mess4))+T_Mess4  // Начало, окончание (прогноз)
    oSay98:SetCaption(Mess98);oSay98:SetCaption(oSay98:caption)

    Mess99 = T_Mess2+SPACE(95-LEN(T_Mess2)-LEN(T_Mess6))+T_Mess6  // Прошло, осталось (прогноз)
    oSay99:SetCaption(Mess99);oSay99:SetCaption(oSay99:caption)

    DC_GetProgress( oProgress, Time_Progress )     // Отображение графического Progress-bar
    DC_AppEvent( @lOk, 0, .01 )

RETURN lOk
End:

Code: Select all

   oSay7:SetCaption("КОНВЕРТИРОВАНИЕ ПРИЛОЖЕНИЯ ИЗ СТАРОГО СТАНДАРТА БД В НОВЫЙ ЗАВЕРШЕНО УСПЕШНО!!!")
   oSay7:SetCaption(oSay7:caption)

   oButton:SetCaption('&Ok')   // Деструктурирование окна отображения графического Progress-bar
   DC_AppEvent( @lOk )
   oDialog:Destroy()
Is once again glad to express huge gratitude to Roger. With support of such old old salt, as Roger, the farthest and risky transatlantic swimming looks as the most fascinating sea cruise on a fine high-speed clipper under all sails.

(Update: 02.07.12 )

Re: Questions of zero level

Posted: Fri Jul 06, 2012 11:43 am
by Eugene Lutsenko
Somebody can will prompt, what options should be used in:

DCBROWSECOL FIELD USERS->Passw_AdmA HEADER 'Password' WIDTH 10

that the field was edited, but not displayed, as at password input.

Re: Questions of zero level

Posted: Sat Jul 07, 2012 2:32 pm
by rdonnay
Are you saying that you do not want to see the password in the browse?
Are you wanting to see * or ? in it's place.
If so, then you can do this:

Code: Select all

DCBROWSECOL DATA {||Repl('?',Len(Trim(USERS->Passw_AdmA)))} HEADER 'Password' WIDTH 10
If you have some kind of Encrypt() or Decrypt() functions and you want to see the encrypted password in the browse, then you can do something like this:

Code: Select all

DCBROWSECOL DATA {||Decrypt(USERS->Passw_AdmA)} HEADER 'Password' WIDTH 10

Re: Questions of zero level

Posted: Sun Jul 08, 2012 4:10 pm
by Cliff Wiernik
He also wants, I think, to be able to use the dcbrowsecol editor to do cell editing of the field. Display like a password, but then do cell editing when the browse field is clicked.

Re: Questions of zero level

Posted: Mon Jul 09, 2012 12:51 am
by Eugene Lutsenko
Thank you very much! Everything well turned out!