erro criar janela de 4 nivel

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

tonyx
Usuário Nível 3
Usuário Nível 3
Mensagens: 303
Registrado em: 07 Jul 2004 15:26

erro criar janela de 4 nivel

Mensagem por tonyx »

Código: Selecionar todos

*--------------------------------------*
* SISTEMA    : PROTOCOLO               *
* EMPRESA    : G.W.M                   *
* MANUTENCAO : ANTONIO SIXEL           *
* PROGRAMA   : ENTRADA                 *
*--------------------------------------*
#include "inkey.ch"
#include "gtinfo.ch"
#include "winuser.ch"
//==============================//
#define COR_NORMAL        setcolor("N/W*,GR+/B*,N/N,GR+/N*,W+/N*,R/W*,W/W*,B/W*") 

//=================//
FUNCTION MAIN()
   
 PUBLIC NOME_SIS,dir_c,DIR_JPG
 //======================
 dir_c:= "c:\teste"
 DIR_JPG:= DIR_C+"\JPG"
 NOME_SIS:= "GWM - TESTE"
 //============================
 REQUEST DBFCDX
 RDDSETDEFAULT("DBFCDX")
 DBSETDRIVER("DBFCDX")
 //======================= teste se esta ativo ======//
 #Define _BARRA_DOS_WINDOWS_ "\"
 If (empty(CreateMutex( , .T., strtran(GetModuleFileName(),_BARRA_DOS_WINDOWS_,'_') )) .or. (GetLastError() > 0 ) )
  wvw_showwindow(0,0) // Esconde janela principal
  wvw_messagebox(,"Sistema [ "+nome_sis+" ] Ja esta Ativo","Alerta",0) // msg_ok
  Quit
 endif
 //============
 iniciar()
 //==========//
 Cria_Menu()
 //========================
 wait "saida do menu"

RETURN

//=============================//
FUNCTION Iniciar()
******************
 local vret := .T.
 *====================
 SET ECHO OFF
 SET ALTERNATE OFF
 *SET BELL OFF
 *SET CARRY OFF
 SET CENTURY ON
 SET CONFIRM OFF
 SET CONSOLE ON
 SET DATE FRENCH
 SET DECIMALS TO 2
 SET DELETE ON
 SET DELIMITERS OFF
 SET DEVICE TO SCREE
 SET ESCAPE ON
 SET EXACT ON
 SET FIXED OFF
 SET HEADING ON
 SET INTENSITY ON
 SET MENU ON
 SET PRINT OFF
 SET SAFETY ON
 SET SCOREBOARD OFF
 SET STATUS OFF
 SET TALK OFF
 SET UNIQUE OFF
 SET CURSOR ON
 *========================
 RUN CD &DIR_C
 SET PATH TO &DIR_C
 SET DEFA TO &DIR_C
 SET EXCLUSIVE OFF
 SET AUTOPEN OFF
 *---------------------------- PARA O XHARBOUR --------------
 set dbflockscheme to 2  // PARA USO JUNTO COM O CLIPPER
 //REQUEST HB_NOMOUSE
 *========
 REQUEST HB_LANG_PT
 HB_LANGSELECT("PT")
 *-----
 REQUEST HB_CODEPAGE_PT850
 HB_SETCODEPAGE("PT850")
 *------
 REQUEST DBFCDX
 RDDSETDEFAULT("DBFCDX")
 DBSETDRIVER("DBFCDX")
 *------
 mfonte="Lucida Console"
 wvw_setcodepage(,255)
 wvw_settitle(0,nome_sis)
 SETMODE(24,80)
 //  DOS = 24,80 => mfonte="Terminal"
 //    gtinfo(GTI_FONTSIZE, 24) 
 //  NAO APARECE A BARRA DE TITULO 
 //  ------- COM BARRA DE TITULO ------ 
 do case  // Identifica a resolucao do video
   case gtinfo(GTI_DESKTOPWIDTH) > 1439
    gtinfo(GTI_FONTWIDTH, 12) // 12 anterior   //   13  //   12
    gtinfo(GTI_FONTSIZE, 27)  // 28 anterior   //   29  //   27
    // wvw_setfont(,mfonte,32,1440/maxcol()) //29,12
    // wvw_setfont(,mfonte,32,12) //29,12

   case gtinfo(GTI_DESKTOPWIDTH) > 1023
    gtinfo(GTI_FONTWIDTH, 12) // 12 anterior   //   13  //   12
    gtinfo(GTI_FONTSIZE, 27)  // 28 anterior   //   29  //   27
    // wvw_setfont(,mfonte,32,1024/maxcol()) //29,12
    // wvw_setfont(,mfonte,32,12) //29,12

   case gtinfo(GTI_DESKTOPWIDTH) > 799
    //gtinfo(GTI_FONTWIDTH, 10 ) // 10 anterior  //   10
    //gtinfo(GTI_FONTSIZE, 22 )  // 20 anterior  //   22

    SETMODE(24,80)
    wvw_setfont(,mfonte,23,10) //23,10
   
   otherwise
    gtinfo(GTI_FONTWIDTH, 8)
    gtinfo(GTI_FONTSIZE, 17)
    // wvw_setfont(,mfonte,18,round(640/maxcol(),0)) // 18,8
    //  wvw_setfont(,mfonte,18,8) // 18,8
 endcase
 //----------------------------------------
 //WVW_NOCLOSE() // desabilitando o X
 WVW_SetIcon(, DIR_JPG+'\GWM.ICO' )
 //wvw_setmousemove(.t.)
 //wvw_size_ready(.T.)
 // wvw_setmaincoord(.t.)
 //wvw_SBcreate()
 //wvw_SBaddPart(, "99:99:99")
 //wvw_SetTimer(, 1000)
 //set(20,100)  // nada serve
 //wvw_showwindow(0,0) // Esconde janela principal
 //   wvw_SetPaintRefresh(0)
 //   wvw_SetVertCaret(.F.)
 //   wvw_enableshortcuts(0,.T.)
 SETINKEYAFTERBLOCK({|nkey| AfterInkey(nkey)})
 COR_NORMAL
 CLEAR 
return(vret)
//==========================================//

Function cria_menu()
 private MenuMain
 op_101:= 1
 op_102:= 2
 //==============//
 MenuMain = WVW_CreateMenu( ) 
   //==============================//
   Menu_A = WVW_CreateMenu( )
     Menu_A_2 = WVW_CreateMenu( ) 
     WVW_AppendMenu( Menu_A_2 , MF_ENABLED + MF_STRING,op_101 ,"1- op_1- menu_A_1" ) 
     WVW_AppendMenu( Menu_A_2 , MF_ENABLED + MF_STRING,op_102 ,"2- op_2- menu_A_1" )
   WVW_AppendMenu( Menu_A , MF_ENABLED + MF_POPUP ,   , "1- Menu_A_1"  )
   WVW_AppendMenu( Menu_A , MF_ENABLED + MF_POPUP ,Menu_A_2 , "2- Menu_A_2"  )
   //=============================//
   Menu_B = WVW_CreateMenu( )
     Menu_B_2 = WVW_CreateMenu( )

//========================== erro esta aqui ======
       Menu_B_2_2 = WVW_CreateMenu( )  // JA DA ERRO AO CRIAR
//       WVW_AppendMenu( Menu_B_2_2 , MF_ENABLED + MF_STRING, op_203, "1- op1 - menu_B_2_2") 
//       WVW_AppendMenu( Menu_B_2_2 , MF_ENABLED + MF_STRING, op_204, "2- op2 - Menu_B_2_2") 
//       WVW_AppendMenu( Menu_B_2_2 , MF_ENABLED + MF_STRING, op_205, "3- op3 - Menu_B_2_2") 
          
//     WVW_AppendMenu( Menu_B_2 , MF_ENABLED + MF_STRING, op_202    , "1- op1 - menu_B_2") 
   WVW_AppendMenu( Menu_B_2 , MF_ENABLED + MF_STRING, Menu_B_2_2, "2- op2 - menu_B_2") 

   WVW_AppendMenu( Menu_B , MF_ENABLED + MF_POPUP ,   , "1- Menu_B_1",  )
   WVW_AppendMenu( Menu_B , MF_ENABLED + MF_POPUP , Menu_B_2, "2- Menu_B_2",  )
   ///
 WVW_AppendMenu( MenuMain , MF_ENABLED + MF_POPUP , Menu_A  , "A- menu_A",  )
 WVW_AppendMenu( MenuMain , MF_ENABLED + MF_POPUP , Menu_B , "B- menu_B",  )

  //================================//
  WVW_SetMenu(, MenuMain )
  //=========================== LOOP DO MENU =====//
  do while lastkey()<>27
    inkey(0)
  enddo
return

function AfterInkey(nkey)
local MenuId
 IF nKey=1024
  MenuId:=WVW_GETLASTMENUEVENT()
  DO CASE
   case MenuId = op_101
    fop_1()
   CASE MenuId = OP_102
    fop_2()
  ENDCASE
 ENDIF
return nkey

//==================
function fop_1
  setcolor('N/W')
  wvw_nopenwindow('',5,5,7,20)
  @ 1,1 say 'teste1'
  inkey(0)
  wvw_lclosewindow()
return nil

function fop_2
  setcolor('N/W')
  wvw_nopenwindow('',5,5,7,20)
  tt = '1'
  @ 1,1 say 'teste2' get tt pict '9'
  read
  inkey(0)
  wvw_lclosewindow()
return nil
Editado pela última vez por Toledo em 04 Jun 2010 19:35, em um total de 1 vez.
Razão: Mensagem editada para colocar a tag [ code ]<br>Veja como utilizar esta tag: http://www.pctoledo.com.br/forum/faq.php?mode=bbcode#f2r1
Avatar do usuário
gvc
Colaborador
Colaborador
Mensagens: 1270
Registrado em: 23 Ago 2005 10:57

Re: erro criar janela de 4 nivel

Mensagem por gvc »

Ok. Vc postou o código fonte mas não falou nada sobre o erro.
O titulo é auto explicativo?
"TRS-80/Sincler/Apple/PC - Clipper Winter 85, tlink 1.0 [pc 10 MHz - 640K] {NEZ 8000 2Kb RAM}"
{POG - Programação Orientada a Gambiarra}
tonyx
Usuário Nível 3
Usuário Nível 3
Mensagens: 303
Registrado em: 07 Jul 2004 15:26

Re: erro criar janela de 4 nivel

Mensagem por tonyx »

Quebrei a cabeca mas consegui :P

Finalmente consegui entender e fazer funcionar ate o 4 nivel de menu com WVW_APPENDMENU

Código: Selecionar todos

//============================//
Function cria_menu()
 private MenuMain
 private op_1,op_2,op_3
 op_1:= 1
 op_2:= 2
 op_3:= 3
 //==============//
 MenuMain= WVW_CreateMenu()
  Menu_A:= WVW_CreateMenu()
     Menu_A_3:= WVW_CreateMenu()
  Menu_B:= WVW_CreateMenu()
     Menu_B_3:= WVW_CreateMenu()
  Menu_C:= WVW_CreateMenu()
     Menu_C_1:= WVW_CreateMenu()
       Menu_C_11:= WVW_CreateMenu()
         Menu_C_111:= WVW_CreateMenu()
 //==========================
 WVW_AppendMenu( MenuMain, MF_ENABLED + MF_POPUP, Menu_A, "A- Menu_A" )
 //====== MENU_A
    WVW_AppendMenu( Menu_A, MF_ENABLED + MF_STRING, OP_1, "1- Op_1 Menu_A"  )
    WVW_AppendMenu( Menu_A, MF_ENABLED + MF_STRING, OP_2, "2- Op_2 Menu_A"  )
       WVW_AppendMenu( Menu_A, MF_ENABLED + MF_POPUP, Menu_A_3, "3- Menu_A_3" )
          WVW_AppendMenu( Menu_A_3, MF_ENABLED + MF_STRING, OP_1, "1- Op_1 Menu_A_3"  )
          WVW_AppendMenu( Menu_A_3, MF_ENABLED + MF_STRING, OP_2, "2- Op_1 Menu_A_3"  )
 //===== MENU B
    WVW_AppendMenu( MenuMain, MF_ENABLED + MF_POPUP, Menu_B, "A- Menu_A" )
       WVW_AppendMenu( Menu_B, MF_ENABLED + MF_STRING, OP_1, "1- Op_1 Menu_B"  )
       WVW_AppendMenu( Menu_B, MF_ENABLED + MF_STRING, OP_2, "2- Op_1 Menu_B"  )
       MENUTRACOS  MENU_B
       WVW_AppendMenu( Menu_B, MF_ENABLED + MF_POPUP, Menu_B_3, "3- Menu_A_3" )
          WVW_AppendMenu( Menu_B_3, MF_ENABLED + MF_STRING, OP_1, "1- Op_1 Menu_B_3"  )
          WVW_AppendMenu( Menu_B_3, MF_ENABLED + MF_STRING, OP_2, "2- Op_2 Menu_B_3"  )
          WVW_AppendMenu( Menu_B_3, MF_ENABLED + MF_STRING, OP_2, "3- Op_3 Menu_B_3"  )
  // MENU_C
    WVW_AppendMenu( MenuMain, MF_ENABLED + MF_POPUP, Menu_C, "C- Menu_C" )
       WVW_AppendMenu( Menu_C, MF_ENABLED + MF_POPUP, Menu_C_1, "1- Menu_C1" )
          WVW_AppendMenu( Menu_C_1, MF_ENABLED + MF_POPUP, Menu_C_11, "1- Menu_C11" )
             WVW_AppendMenu( Menu_C_11, MF_ENABLED + MF_POPUP, Menu_C_111, "1- Menu_C111" )
                WVW_AppendMenu( Menu_C_111, MF_ENABLED + MF_STRING, OP_2, "1- Op_1 Menu_C_111"  )
 //================================//
 WVW_SetMenu(, MenuMain )
 //=========================== LOOP DO MENU =====//
 do while lastkey()<>27
  inkey(0)
 enddo
return

function AfterInkey(nkey)
local MenuId
 IF nKey=1024
  MenuId:=WVW_GETLASTMENUEVENT()
  DO CASE
   case MenuId = op_1
    fop_1()
   CASE MenuId = OP_2
    fop_2()
  ENDCASE
 ENDIF
return nkey

//==================
function fop_1
  setcolor('N/W')
  wvw_nopenwindow('',5,5,7,20)
  @ 1,1 say 'teste1'
  inkey(0)
  wvw_lclosewindow()
return nil

function fop_2
  setcolor('N/W')
  wvw_nopenwindow('',5,5,7,20)
  tt = '1'
  @ 1,1 say 'teste2' get tt pict '9'
  read
  inkey(0)
  wvw_lclosewindow()
return nil
Editado pela última vez por Toledo em 04 Jun 2010 19:34, em um total de 1 vez.
Razão: Mensagem editada para colocar a tag [ code ]<br>Veja como utilizar esta tag: http://www.pctoledo.com.br/forum/faq.php?mode=bbcode#f2r1
Avatar do usuário
sygecom
Administrador
Administrador
Mensagens: 7131
Registrado em: 21 Jul 2006 10:12
Localização: Alvorada-RS
Contato:

Re: erro criar janela de 4 nivel

Mensagem por sygecom »

Olá Antonio,
Menos mal que consegui resolver, quando tiver com dificuldades com a gtwvw pode dar uma consultada também na wvwtools que tem algumas rotinas que facilita o uso da gtwvw. Você pode achar a wvwtools no site do xharbour.com
Leonardo Machado
xHarbour.org + Hwgui + PostgreSql
Responder