Changing Main Window Title

Changing Main Window Title

Postby Ollie » Wed Feb 29, 2012 3:10 am

I define the main window of my app as follows:

Code: Select all  Expand view
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)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Re: Changing Main Window Title

Postby anserkk » Wed Feb 29, 2012 4:15 am

Did you try

Code: Select all  Expand view
WndMain():cTitle:="Changed the Title to FiveWin"


Here is a sample code

Code: Select all  Expand view
#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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Changing Main Window Title

Postby Ollie » Wed Feb 29, 2012 4:41 am

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 92 guests