Mount the cTipTool fields at runtime read in a text file

Mount the cTipTool fields at runtime read in a text file

Postby ORibeiro » Thu Jun 26, 2014 8:08 pm

I set up a function to mount the cTipTool fields at runtime read in a text file.
 
The Search function below the "OASHELP.MEM" file in the system folder: pPath + "OASHELP.MEM". You can rename this file and the path.
 
This file must have the following composition:
[Section] -> This section should be the name of the program that creates the Dialog ProcName (1)
0000 = OK -> This first line indicates that the file is complete with OK, any other information here show the number of fields.
0001 = Text -> Enter here the text of the TipTool tget field TBUTTONBMP OR TCheckBox within or Folder Dialog
 
When you open the Dialog system will read this file and write the TipTool fields so need not be defined in programming time, but, the staff responsible for system documentation.

Code: Select all  Expand view

********************************************************************************************
FUNCTION OATipTool( oDlg, cFrm ) // Monta TipTool dos Campos com base no arquivo OASHELP.MEM
********************************************************************************************
   Local f:=1,g:=1,h:=1,cRes:=""
   Default cFrm := ""
   if !File(pPath+"OASHELP.MEM") // Verifica se o arquivo OASHELP.MEM existe na pasta do sistema
      Return nil
   endif
   cFrm := StrTran(cFrm,'_','')
   cRes := GetPvProfString(cFrm,"0000",,pPath+"OASHELP.MEM")
   if Empty(cRes)                // Verifica se o registro 0000 existe dentro da Seção com o nome da Tela
      Return nil
   endif
   While f<=Len(oDlg:aControls) //acontrols é uma propriedade de todas as dialogs e é criada automaticamente
      /////////////////////////////
      // FOLDER DENTRO DA DIALOG //
      /////////////////////////////
      if     oDlg:aControls[f]:ClassName()="TFOLDER"
         g := 1
         While g<=Len(oDlg:aControls[f]:aDialogs) // Checa todos os Dialogs da Folder
            h := 1
            While h<=Len(oDlg:aControls[f]:aDialogs[g]:aControls)
               if oDlg:aControls[f]:aDialogs[g]:aControls[h]:ClassName()$"TGET/TBUTTONBMP/TCHECKBOX"
                  if oDlg:aControls[f]:aDialogs[g]:aControls[h]:cToolTip = nil
                     oDlg:aControls[f]:aDialogs[g]:aControls[h]:cToolTip:= GetPvProfString(cFrm,strzero(g,2)+strzero(h,2),,pPath+"OASHELP.MEM")
                     if oDlg:aControls[f]:aDialogs[g]:aControls[h]:cToolTip = ""
                        if cRes="OK" // 0000=OK  quando terminar o Help da Dialog
                           oDlg:aControls[f]:aDialogs[g]:aControls[h]:cToolTip:= nil
                        else         // 0000=CAD para que o sistema numere os objetos do Dialog para facilitar a edição
                           oDlg:aControls[f]:aDialogs[g]:aControls[h]:cToolTip:= strzero(g,2)+strzero(h,2)
                        endif
                     endif
                  endif
               endif
               h++
            enddo
            g++
         end
      /////////////////////////////
      // DIALOG SEM FOLDER       //
      /////////////////////////////
      elseif oDlg:aControls[f]:ClassName()$"TGET/TBUTTONBMP/TCHECKBOX"
         if oDlg:aControls[f]:cToolTip = nil
            oDlg:aControls[f]:cToolTip:= GetPvProfString(cFrm,strzero(0,2)+strzero(f,2),,pPath+"OASHELP.MEM")
            if oDlg:aControls[f]:cToolTip = ""
               if cRes="OK" // 0000=OK  quando terminar o Help da Dialog
                  oDlg:aControls[f]:cToolTip:= nil
               else         // 0000=CAD para que o sistema numere os objetos do Dialog para facilitar a edição
                  oDlg:aControls[f]:cToolTip:= strzero(0,2)+strzero(f,2)
               endif
            endif
         endif
      endif
      f++
   End
Return nil
 
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: Mount the cTipTool fields at runtime read in a text file

Postby Antonio Linares » Thu Jun 26, 2014 10:28 pm

Oscar,

Thanks for sharing your solutions :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41411
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests