definition controls problem in windows

Moderator: Rathinagiri

Post Reply
User avatar
dodogo
Posts: 17
Joined: Thu Feb 11, 2010 9:14 pm
Location: Prešov, Slovakia, EU

definition controls problem in windows

Post by dodogo » Fri Feb 15, 2013 11:00 pm

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

User avatar
dodogo
Posts: 17
Joined: Thu Feb 11, 2010 9:14 pm
Location: Prešov, Slovakia, EU

Post by dodogo » Fri Feb 15, 2013 11:03 pm

case.GIF
case.GIF (26.84 KiB) Viewed 1714 times
sorry wrong extension in picture file..

User avatar
danielmaximiliano
Posts: 2052
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 89 times
Been thanked: 13 times
Contact:

Post by danielmaximiliano » Fri Feb 15, 2013 11:15 pm

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' ) 
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 246 times
Been thanked: 91 times
Contact:

Post by esgici » Fri Feb 15, 2013 11:27 pm

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
Viva INTERNATIONAL HMG :D

User avatar
dodogo
Posts: 17
Joined: Thu Feb 11, 2010 9:14 pm
Location: Prešov, Slovakia, EU

Post by dodogo » Thu Feb 21, 2013 11:31 pm

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

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 246 times
Been thanked: 91 times
Contact:

Post by esgici » Fri Feb 22, 2013 12:01 am

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
Viva INTERNATIONAL HMG :D

User avatar
dodogo
Posts: 17
Joined: Thu Feb 11, 2010 9:14 pm
Location: Prešov, Slovakia, EU

Post by dodogo » Fri Feb 22, 2013 1:05 am

but extended edition have MDI...

User avatar
esgici
Posts: 4363
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 246 times
Been thanked: 91 times
Contact:

Post by esgici » Fri Feb 22, 2013 2:33 am

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
Viva INTERNATIONAL HMG :D

User avatar
PeteWG
Posts: 107
Joined: Sun Mar 21, 2010 5:45 pm
Has thanked: 3 times
Been thanked: 27 times

Post by PeteWG » Fri Feb 22, 2013 3:22 pm

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

Post Reply