FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Possible, to send a value from mdi-child to main-window ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Possible, to send a value from mdi-child to main-window ?
Posted: Sat Apr 26, 2008 11:31 AM
Hello,

I have a little problem :



With one Button in the office-bar (Main-window), i want to know the position inside a folder of a child.
To define a PUBLIC-var at start, doesn't help

Is it possible to use just 1 Button to start a action in relation
of the folder-position ?

Regards

Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Possible, to send a value from mdi-child to main-window ?
Posted: Sat Apr 26, 2008 03:51 PM

Have you tried oFolder:nOption?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Message from Child to Main-Window
Posted: Sat Apr 26, 2008 04:58 PM

Hello James,

The problem is, i want to start a action in the main-window.
In the main window, i define a var < nPROGPOS = 1 >.
In the Child, the var gets the value from the folder :

ON CHANGE Optionget( nOption, nOldoption)
nPROGPOS := nOption

A Test in the Child => nPROGPOS has the value from the folder-pos.
Inside the child, everything is ok.

But when i press the button in the Main-Window
nPROGPOS is allways 1.

I need the nOption-value in the office-bar.
When it is impossible to do it this way, i have to create a button
in each folder for the needed action.

It seems, nPROGPOS in the Main-window is different to the one
in the Child.
I checked : Public, static, private, by reference
No chance at all.

Regards

Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Possible, to send a value from mdi-child to main-window ?
Posted: Sat Apr 26, 2008 09:35 PM
Uwe,

Use a static inside a function. You can set it in the child window and retreive it from anywhere.

James

function setOption(nNewOption)
   local nReply
   static nOldOption:=1
   nReply:= nOldOption
   if nNewOption != nil
      nOldOption:= nNewOption
   endif
return nReply
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Message from MDI-Folder to Main-Window
Posted: Sun Apr 27, 2008 09:33 AM
Hello James,

I added the Function to the program and it works fine now.
Thank you very much.

STATIC nOption

FUNCTION MAIN() 
LOCAL  oWnd, oBar, oBtn1, oBtn2

DEFINE WINDOW oWnd TITLE "Test"  MDI MENU TMenu():New() 

DEFINE BUTTONBAR oBar 3DLOOK OF oWnd BUTTONSIZE 70,80 2007 RIGHT

// Folder
DEFINE BUTTON oBtn1 OF oBar ;
ACTION ( BRW_DESIGN(oWnd) ) ;
              RESOURCE "notes_5" PROMPT "Visual" + CRLF + "Tools"

// Action-Button for Folder-Tabs
// ---------------------------------------
DEFINE BUTTON oBtn2 OF oBar ;
ACTION ( SHOW_POS( setOption(nOption) ) ;   //  Get the Folder-Tab-Position
RESOURCE "magic_5" PROMPT "Show " + CRLF + "Design"

ACTIVATE WINDOW oWnd MAXIMIZED

// --------------------------------

FUNCTION BRW_DESIGN(oWnd)
LOCAL oDlg1, oFld, oProg

DEFINE DIALOG oDlg1  RESOURCE "BRWDESIGN"  OF oWnd

REDEFINE FOLDER oFld ID 300 OF oDlg1 FONT oProgFont  ;
PROMPTS "  &Colors  ", "  &Lines & Grids  ", "  &Fonts & Bitmaps  ", "  &Dialog-Titles  ", ;
                   "  &Windows & Dialog  "," &Gif-Test"  ;
DIALOGS "Browse1", "Browse2", "Browse3", "Browse4", "Browse5", "Browse6"  ;
ON CHANGE( MsgAlert( oFld:nOption ) ) // activ Option

ACTIVATE DIALOG oDlg1 CENTERED NOWAIT

RETURN( NIL )

// ------------------------------

FUNCTION SetOption(nNewOption) 
local nReply 
static nOldOption:=1 
nReply:= nOldOption 
IF nNewOption != nil 
         nOldOption:= nNewOption 
ENDIF 
RETURN nReply

// -------------------------------

FUNCTION SHOW_POS(nPosition)

// Options in Relation to Folder-Tabs
// ---------------------------------------------
MsgAlert( "Folder-Pos : " + str(nPosition), "Position" )

RETURN( NIL )


Uwe :-) [/code]
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Possible, to send a value from mdi-child to main-window ?
Posted: Sun Apr 27, 2008 04:44 PM

Uwe,

>I added the Function to the program and it works fine now.

Glad to hear it. You may want to make the function a static function so it can't be seen elsewhere in your program.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion