Page 1 of 1

definition controls problem in windows

Posted: Fri Feb 15, 2013 11:00 pm
by dodogo
Hi men.
I have still same problem. After definition window and show it, I try manipulate with control (grid, label..) Look picture from example.
I use HMG311 and minigui extended (2.1.9) with same results. "Control: xxx Of Winxxx Not defined. Program terminated,

Can You help me?
THX Dodogo

Re: definition controls problem in windows

Posted: Fri Feb 15, 2013 11:03 pm
by dodogo
case.GIF
case.GIF (26.84 KiB) Viewed 10988 times
sorry wrong extension in picture file..

Re: definition controls problem in windows

Posted: Fri Feb 15, 2013 11:15 pm
by danielmaximiliano
dodogo wrote: sorry wrong extension in picture file..
you better post an example?

or just use GetProperty( Window, Control , value )

Ej :

Code: Select all

 SendEmail.Text_1.Value := GetProperty( 'Incomming' , 'cUser' , 'value' ) 

Re: definition controls problem in windows

Posted: Fri Feb 15, 2013 11:27 pm
by esgici
dodogo wrote:Hi men.
I have still same problem. After definition window and show it, I try manipulate with control (grid, label..) Look picture from example.
I use HMG311 and minigui extended (2.1.9) with same results. "Control: xxx Of Winxxx Not defined. Program terminated,
Hi

Your problem might be this :
HMG Doc wrote: DECLARE WINDOW <WindowName>

A window must be declared using this command, if you need to refer to it prior
its definition in code, or when you refer to it in a different .prg file from
the one it was defined using semi-oop syntax.
Viva HMG :D

Re: definition controls problem in windows

Posted: Thu Feb 21, 2013 11:31 pm
by dodogo
Hi.
Here is same example.

Code: Select all

#include "minigui.ch"

********************************************************************************
Function Main
********************************************************************************

    nWidth  := GetDesktopWidth() * 0.4
    nHeight := GetDesktopHeight() * 0.4

    WinMain(nWidth,nHeight)
    
Return Nil

********************************************************************************
Function WinMain(nWidth,nHeight)
********************************************************************************

       DEFINE WINDOW winMain ;
              AT 0,0 ;
              WIDTH nWidth ;
              HEIGHT nHeight ;
              TITLE 'PackFlowEE ' ;
              MAIN;
              MDI;
              FONT 'System' SIZE 12 

              DEFINE MAIN MENU

                     POPUP 'File'
                            ITEM 'Open'         ACTION WinStockFlow2() 
                            ITEM 'Exit'         ACTION winMain.Release
                     END POPUP

              END MENU

       END WINDOW

       CENTER WINDOW winMain

       ACTIVATE WINDOW winMain 
RETURN  Nil

********************************************************************************
FUNCTION WinStockFlow2()
********************************************************************************
    	
	define window WinStockFlow at 0,0 width 200 height 200 title 'WinStockFlow'	MDICHILD ;
			font 'ms sans serif' size 8 ;  

            DEFINE LABEL lblTest
                ROW    40
                COL    50
                WIDTH  120
                HEIGHT 20
                VALUE "Test:"
                FONTNAME "Arial"
                FONTSIZE 10
                FONTBOLD .T.
            END LABEL
        DEFINE BUTTON btnTest
            ROW    60
            COL    50
            WIDTH  100
            HEIGHT 28
            ACTION test()
            CAPTION "Test"
            FONTNAME "Arial"
            FONTSIZE 10
            FLAT .F.
            TABSTOP .T.
            VISIBLE .T.
        END BUTTON
        
	end window

*	WinStockFlow.center
*	activate window WinStockFlow
	
return Nil

********************************************************************************
function test()
********************************************************************************
    msgstop(WinStockFlow.lblTest.value)
return Nil

Re: definition controls problem in windows

Posted: Fri Feb 22, 2013 12:01 am
by esgici
Hi dodogo
dodogo wrote:Here is same example.
Here fixed (and working) version of your program.

Problem points commented by "//" and test statements de-commented.

Code: Select all

#include "minigui.ch"

********************************************************************************
Function Main
********************************************************************************

    nWidth  := GetDesktopWidth() * 0.4
    nHeight := GetDesktopHeight() * 0.4

    WinMain(nWidth,nHeight)
    
Return Nil

********************************************************************************
Function WinMain(nWidth,nHeight)
********************************************************************************

       DEFINE WINDOW winMain ;
              AT 0,0 ;
              WIDTH nWidth ;
              HEIGHT nHeight ;
              TITLE 'PackFlowEE ' ;
              MAIN; //           MDI;
              FONT 'System' SIZE 12 

              DEFINE MAIN MENU

                     POPUP 'File'
                            ITEM 'Open'         ACTION WinStockFlow2() 
                            ITEM 'Exit'         ACTION winMain.Release
                     END POPUP

              END MENU

       END WINDOW

       CENTER WINDOW winMain

       ACTIVATE WINDOW winMain 
RETURN  Nil

********************************************************************************
FUNCTION WinStockFlow2()
********************************************************************************
       
   define window WinStockFlow at 0,0 width 200 height 200 title 'WinStockFlow' ; //   MDICHILD ;
         font 'ms sans serif' size 8 // ;  

            DEFINE LABEL lblTest
                ROW    40
                COL    50
                WIDTH  120
                HEIGHT 20
                VALUE "Test:"
                FONTNAME "Arial"
                FONTSIZE 10
                FONTBOLD .T.
            END LABEL
        DEFINE BUTTON btnTest
            ROW    60
            COL    50
            WIDTH  100
            HEIGHT 28
            ACTION test()
            CAPTION "Test"
            FONTNAME "Arial"
            FONTSIZE 10
            FLAT .F.
            TABSTOP .T.
            VISIBLE .T.
        END BUTTON
        
   end window

   WinStockFlow.center
   activate window WinStockFlow
   
return Nil

********************************************************************************
function test()
********************************************************************************
    msgstop(WinStockFlow.lblTest.value)
return Nil
PS : HMG official doesn't support MDI windows .

Happy HMG'ing :D

Re: definition controls problem in windows

Posted: Fri Feb 22, 2013 1:05 am
by dodogo
but extended edition have MDI...

Re: definition controls problem in windows

Posted: Fri Feb 22, 2013 2:33 am
by esgici
dodogo wrote:but extended edition have MDI...
You may find the reality on MDI here

By the way, your problem was not related to MDI ;)

Regards

Re: definition controls problem in windows

Posted: Fri Feb 22, 2013 3:22 pm
by PeteWG
dodogo wrote:but extended edition have MDI...
Yes it's true.
The problem is that MDI support is not very good documented.
Now regarding your problem,

Code: Select all

 ********************************************************************************
function test()
********************************************************************************
    msgstop(WinStockFlow.lblTest.value)
return Nil
try to use MsgStop( WinStockFlow_1.lblTest.value )

In other words, the '_DefineChildMDIWindow' creation routine adds "by design" an "_n" at the end of the name of child window, where "n" is an ascending integer which increments each time a child window is defined. Actually it corresponds to ActiveMDIChildIndex.

Keep this in mind when you utilize MDI's.
But, as already pointed out, MDI usage is tricky and not suggested. If you can, avoid it!

(BTW, since you're using minigui extended you might get better replies if you post you questions also in MiniGUI extended forum )
---
Pete