move controls from dialog to window or panel

move controls from dialog to window or panel

Postby reinaldocrespo » Sun Feb 20, 2011 8:26 pm

Hi.

I remember there was a way to move dialog resources from the dialog to a window or another similar control. I'm trying to move the controls from a resource dialog to a panel. I remember it was something like odlg:sendtowindow( ownd ) or some like that.

Can someone help?


Thank you,



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: move controls from dialog to window or panel

Postby reinaldocrespo » Sun Feb 20, 2011 9:42 pm

Ok... finally I was able to remember the trick. I'm posting it here because I know I will forget and now I know I can look at my previous posts and find the answer:
Code: Select all  Expand view
    Activate Dialog oDlg NOWAIT ON INIT ChangeParent( oDlg, oOtherDlgOrWnd )

function ChangeParent( oDlg, oChild )
local n
   
    for n = 1 to Len( oDlg:aControls )
        SetParent( oDlg:aControls[ n ]:hWnd, oChild:hWnd )
        AAdd( oChild:aControls, oDlg:aControls[ n ] )
    next
   
return nil
 


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: move controls from dialog to window or panel

Postby Silvio » Mon Feb 21, 2011 8:17 am

explain me where it can be usefull , because I not understood!!
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: move controls from dialog to window or panel

Postby anserkk » Mon Feb 21, 2011 9:06 am

Silvio wrote:explain me where it can be usefull , because I not understood!!


One example is :-

You can use a resource editor to design your screen layouts on a DIALOG and using the above posted example, you can move the controls (For eg. GET, SAY etc) from the dialog to a WINDOW at runtime.

Using a resource editor saves your screen designing time and once you have designed the screen, later you can move all the controls from the dialog to a window at run time. This becomes useful mostly when you want to use a window in your application and you need to design the screen layout using a resource editor.

I have not used any resource editors till now, and what I understand is that you can design only DIALOG's using a resource editor and NOT a WINDOW

Regards
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: move controls from dialog to window or panel

Postby Silvio » Mon Feb 21, 2011 9:11 am

Perhaps with a pratical sample Can I understand
But on Windows seven I not use a resource editor for the dialog because it too leak memory, i use pellesc only to save bmps
We need an editor to create easy dialog on source code to create easy our applications
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: move controls from dialog to window or panel

Postby reinaldocrespo » Tue Feb 22, 2011 2:42 pm

Silvio;

How are you?

Anser's response is quite complete.

There are also other situations where you MUST use a redefined control. I could list some. But I suppose one example is plenty. So far, I have never been able to create a dtpicker control with style DTS_SHOWNONE from source. That's a dtpicker control that might return an empty date. But with this technique I am able to place such control on a explorer panel.

See below:
Image

Hope this helps,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests