About errors in the definition of controls

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

About errors in the definition of controls

Post by jparada »

Translated by Google

I am having an error that seems very strange, I have something like this:


PROCEDURE IndexarArchivos

DECLARE WINDOW frmIndexar
Local OArch
Private first_time, save_curs, TotGlobal:= TotReg := RegAct := 0

DEFINE WINDOW frmIndexar ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 560 ;
TITLE 'Mantenimiento de archivos' ;
MODAL ;
NOSIZE ;
FONT 'ARIAL' SIZE 9

@ 40,40 FRAME oFrame ;
WIDTH 330 ;
HEIGHT 300

@ 40,390 FRAME oFrame1 ;
WIDTH 370 ;
HEIGHT 300

@ 160, 410 PROGRESSBAR oBarraIndividual ;
RANGE 0,100 ;
WIDTH 330 HEIGHT 40

@ 370 , 40 PROGRESSBAR oBarraGeneral ;
RANGE 0,100 ;
WIDTH 720 HEIGHT 40


@ 450,400 BUTTON BtnAceptar ;
CAPTION '&Aceptar' ;
ACTION IniciarIndexado( ) ;
FONT "Arial" SIZE 9


@ 450,660 BUTTON BtnCancelar ;
CAPTION '&Cancelar' ;
ACTION frmIndexar.RELEASE ;
FONT "Arial" SIZE 9

frmIndexar.BtnCancelar.SetFocus

END WINDOW

CENTER WINDOW frmIndexar

ACTIVATE WINDOW frmIndexar

RETURN Nil



Function IniciarIndexado( )

@420,300 LABEL ctexto VALUE "Texto"
* @400,350 TEXTBOX cCaptura

@ 300,390 FRAME oFrame3 ;
WIDTH 370 ;
HEIGHT 300
Return
/************/

For each control that is trying to define a different error, which for ease of reference, annex image.

What am I doing wrong because I can not find the solution.

Thanks for your comments and suggestions

Greetings
Javier
Attachments
Errors.jpg
Errors.jpg (110.38 KiB) Viewed 2523 times

User avatar
AdrianSB
Posts: 17
Joined: Thu Feb 26, 2009 7:38 pm
Location: Argentina - Quilmes

Post by AdrianSB »

Hola Javier

Debes definir un nuevo formulario sobre los que se generarán los nuevos controles dentro de la función IniciarIndexado()

EJEMPLO:

Function IniciarIndexado( )

DEFINE WINDOW frmDetalle ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 560 ;
TITLE 'Detalle del proceso' ;
MODAL

@420,300 LABEL ctexto VALUE "Texto"
* @400,350 TEXTBOX cCaptura

@ 300,390 FRAME oFrame3 ;
WIDTH 370 ;
HEIGHT 300

END WINDOW

ACTIVATE WINDOW frmDetalle

Return

Saludos !!

jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

Post by jparada »

Translated by Google.

Thanks for reply, Adrian, as he tells me of course, opens a new window, and in this case, the behavior is not what I want at the moment I've settled with the OF parameter, thus:


IniciarIndexado Function ()

@ 420.300 cText LABEL VALUE "Text" OF frmIndexar

Thanks

Greetings
Javier

User avatar
AdrianSB
Posts: 17
Joined: Thu Feb 26, 2009 7:38 pm
Location: Argentina - Quilmes

Post by AdrianSB »

OK Javier

Independientemente de la lógica de la interfaces que busques, el hecho es que los errores _ISWINDOWDEFINED(2540) y GETFORMHANDLE(2584) hacen referencia, justamente, a la inexistencia del puntero o manejador de la ventana que contiene a los nuevos objetos.

Lo que sucede es que cuando la librería genera el mensaje de error para dar aviso de la falta de definición de la ventana contenedora, se produce un error de ejecución al intentar concatenar la correspondiente referencia:

En h_textbox.prg : function _DefineTextBox

// Check if the window/form is defined.
if ( .not. _IsWindowDefined( cParentForm ) )
MsgMiniGuiError( "Window: " + cParentForm + " is not defined. Program terminated." )
endif

////////////////////////////////////////////////

En h_Label.prg: Function _DefineLabel ( se llama a GetFormHandle del h_windows.prg )

Function GetFormHandle (FormName)
*-----------------------------------------------------------------------------*
Local mVar , i

mVar := '_' + FormName

i:=&mVar
if i == 0
Return 0
endif

////////////////////////////////////////////////

Saludos !!

TRADUCCION SEGUN GOOGLE

OK Javier

Whatever the logic of search interfaces, the fact is that mistakes _ISWINDOWDEFINED (2540) and GETFORMHANDLE (2584) refers precisely to the lack of a pointer or handle of the window that contains the new objects.

What happens is that when the library generates the error message to give notice of lack of definition of the container window, an error occurs when attempting to concatenate implementation of the relevant reference:

In h_textbox.prg: function _DefineTextBox

/ / Check if the window / form is defined.
If (. Not. _IsWindowDefined (CParentForm))
MsgMiniGuiError ( "Window" cParentForm + + "is not defined. Program terminated.")
Endif

////////////////////////////////////////////////

In h_Label.prg: Function _DefineLabel (calling GetFormHandle of h_windows.prg)

Function GetFormHandle (FormName)
*------------------------------------------------- ----------------------------*
Local MVAR, i

MVAR: = '_' + FormName

I: = & MVAR
If i == 0
Return 0
Endif

////////////////////////////////////////////////

Greetings!

jparada
Posts: 309
Joined: Fri Jan 23, 2009 5:18 pm
Been thanked: 6 times

Post by jparada »

Translated by Google.

Thanks for the explanation Adrian, my idea in this particular form is present throughout the user interface, and if accepted the process of starting the indexed files, passing parameters as the names of the main window and cdxs dBFS and rate of progress etc..

Greetings
Javier

Post Reply