Changing Main Window Title

Post Reply
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Changing Main Window Title

Post 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.
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Changing Main Window Title

Post 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
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Re: Changing Main Window Title

Post by Ollie »

Perfect. Thanks. :D
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Post Reply