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 »

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

Re: definition controls problem in windows

Post by dodogo »

case.GIF
case.GIF (26.84 KiB) Viewed 10951 times
sorry wrong extension in picture file..
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: definition controls problem in windows

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

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: definition controls problem in windows

Post 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
Viva INTERNATIONAL HMG :D
User avatar
dodogo
Posts: 17
Joined: Thu Feb 11, 2010 9:14 pm
Location: Prešov, Slovakia, EU

Re: definition controls problem in windows

Post 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
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: definition controls problem in windows

Post 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
Viva INTERNATIONAL HMG :D
User avatar
dodogo
Posts: 17
Joined: Thu Feb 11, 2010 9:14 pm
Location: Prešov, Slovakia, EU

Re: definition controls problem in windows

Post by dodogo »

but extended edition have MDI...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: definition controls problem in windows

Post 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
Viva INTERNATIONAL HMG :D
PeteWG
Posts: 176
Joined: Sun Mar 21, 2010 5:45 pm

Re: definition controls problem in windows

Post 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
Post Reply