Page 1 of 1

Changing Main Window Title

Posted: Wed Feb 29, 2012 3:10 am
by Ollie
I define the main window of my app as follows:

Code: Select all

DEFINE WINDOW Win_Main FROM 0, 0 TO 600, 800 PIXEL TITLE 'Application name' MDI ICON oIcon MENU mainmenu()
...
...
ACTIVATE WINDOW Win_Main ON INIT login() VALID lExitAllowed
 


The user then logs in and I have a variable: cUsername

I would now like to change the Win_main Title to cUsername + ' Application name'

I've tried this after the login:

hMainWnd := Win_Main:hWnd
SetProp( hMainWnd, "Title", cUsername + ' Application name')
Win_Main:Refresh()

And it gives an error.

Thanks in advance.

Ollie.

Re: Changing Main Window Title

Posted: Wed Feb 29, 2012 4:15 am
by anserkk
Did you try

Code: Select all

WndMain():cTitle:="Changed the Title to FiveWin"
Here is a sample code

Code: Select all

#Include "FiveWin.ch"
//---------------//
Function Main()

    Local oWnd
    
    DEFINE WINDOW oWnd FROM 0, 0 TO 600, 800 PIXEL TITLE 'Application name' MDI 
    
    ACTIVATE WINDOW oWnd ON INIT Login()

Return NIL

//-----------------//
Function Login()

    Local oWnd2,oBtn
    
    DEFINE WINDOW oWnd2 OF WndMain() MDICHILD TITLE "Login"
    
        @10,10 BUTTON oBtn PROMPT "Change Title" SIZE 150,50 ACTION ;
            ( WndMain():cTitle:="Changed the Title to FiveWin" )
          
    ACTIVATE WINDOW oWnd2

Return NIL
Regards
Anser

Re: Changing Main Window Title

Posted: Wed Feb 29, 2012 4:41 am
by Ollie
Perfect. Thanks. :D