Page 1 of 1

Change Dialog Style at runtime

Posted: Fri May 23, 2008 4:49 am
by fraxzi
How to change dialog style define from resource?


RC:

INFO DIALOG 6, 15, 473, 347
STYLE WS_POPUP | WS_VISIBLE | WS_SYSMENU
FONT 10, "Courier"
{
}

PRG:

//perfectly as expected
DEFINE DIALOG oDlg RESOURCE 'INFO'
...
ACTIVATE DIALOG oDlg


//-------------------
//on the other prg with child window

DEFINE WINDOW oWnd TITLE "Test Child" MDICHID

DEFINE DIALOG oDlg RESOURCE 'INFO' OF oWnd
...
ACTIVATE DIALOG oDlg NOWAIT;
ON INIT SetWindowLong( oDlg:hWnd, GWL_EXSTYLE, nOr(WS_CHILD ) )


ACTIVATE WINDOW oWnd
//-------------------

not working as expected...??? the oDlg must be transform to child of oWnd

any help?

The purpose is to use dialog 'INFO' as popup dialog somewhere and a child of oWnd somewhere within the app.

How to change dialog style at runtime?


-Best Regards,

Posted: Fri May 23, 2008 4:55 am
by fraxzi
I GOT IT!!!


Oh my!!! that was easy and fast reply too :P :P :P

I put

....
ACTIVATE DIALOG oDlg NOWAIT CENTERED;
ON INIT SetParent( oDlg:hWnd, oWnd:hWnd )
....

Now I can use dialog as popup and child to any window....

What am I thinking.... :lol: :lol: :lol: :lol: :lol: :lol:


Thanks!

Posted: Fri May 23, 2008 5:14 am
by fraxzi
Yet... still not able to change dialog style at runtime...

The above is just a workaround.... :wink:


Feel free to post your solution please.... :idea:

Dialog-settings at runtime

Posted: Fri May 23, 2008 7:45 am
by ukoenig
Hello,

There is a toppic for V-tools in the forum.
There, i change everything at runtime.
Afterwards i write the source for it.
You find it at :

http://www.pflegeplus.com/fw_downloads/vtools.zip

When you need, i can send you the complete source-part of the
dialog-handling of V-Tools.

The new Version 2.0 is nearly finished with many new functions
and support Vista and the new FWH 8.05

It writes now the complete source of a design and includes
the make file as well, building the exe-file.

In another 2 weeks it be be finished.

Best Regards

Uwe :lol:

Posted: Fri May 23, 2008 10:41 am
by Antonio Linares
Frances,

Some styles can be changed at runtime, some others can't be change. Its a Windows limitation.

In those cases you can only end() the dialog (destroy it) and create a new one with the right styles.

Posted: Fri May 23, 2008 3:09 pm
by fraxzi
Mr. Antonio,

After years of programming with Xharbour.org/FWH....
Fivewin is so robust and flexible you can have some workaround effortlessly... to fit one's style in coding...



Glad 8) you're 8) here!


Best regards,