FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Dlg2Wnd
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM

Dlg2Wnd

Posted: Mon Apr 11, 2022 08:03 PM

Hi dear friends,

I searched this forum without success- so I ask you if anyone knows a tool or procedure to transform a dialog into a window?
My dialog is designed with rc-editor of Pelles C because this way it's easy to place all my controls.
But I want a window as start screen.

I'll be glad for each hint.
-Detlef

Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM

Re: Dlg2Wnd

Posted: Mon Apr 11, 2022 10:29 PM

Detlef:
A good starting point would be to look at the xbrowser function which uses a resizable dialog

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 09:30 AM

Detlef,

If you use the style WS_THICKFRAME in your dialog then you will be able to resize it

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 09:45 AM
Code (fw): Select all Collapse
DEFINE DIALOG oDlg RESIZABLE
Regards



G. N. Rao.

Hyderabad, India
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 03:59 PM

Many thanks for all your help.
Unfortunately I did explain my concern very bad.
It was not the resizing that I wanted.

My program should start showing a window with buttonbar, three browses, a memo edit and some normal buttons.
I found it very annoying to place all those objects by trying to find exact values for @ y, x . . . to align all my objects.
So I created a Dialog with Pelles rc-editor and was able to place all my controls visually much more comfortable.
Now I'm looking for a way to covert this dialog to a window object.

May be I will write a codeblock for right clicks of my components to display the exact coordinates.
Those values I could use to design a window looking equal to that dialog.

-Detlef

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 04:41 PM
Dear Detlef,

Here you have an example you can use in your apps:

Code (fw): Select all Collapse
#include "FiveWin.ch"

#define GW_CHILD        5
#define GW_HWNDNEXT     2

function Main()

   local oWnd

   DEFINE WINDOW oWnd

   ACTIVATE WINDOW oWnd ON INIT GetControls( oWnd, "MyDialog" )

return nil

function GetControls( oWnd, cResName )

   local oDlg 

   DEFINE DIALOG oDlg RESOURCE cResName

   ACTIVATE DIALOG oDlg ON INIT ( MoveControls( oDlg, oWnd ), oDlg:End() )

return nil

function MoveControls( oDlg, oWnd )

   local hCtrl := GetWindow( oDlg:hWnd, GW_CHILD ), hCtrlNext

   while hCtrl != 0 .and. GetParent( hCtrl ) == oDlg:hWnd
      hCtrlNext = GetWindow( hCtrl, GW_HWNDNEXT )
      SetParent( hCtrl, oWnd:hWnd )
      hCtrl = hCtrlNext
   end
   
   oWnd:aControls = oDlg:aControls
   AEval( oWnd:aControls, { | oCtrl | oCtrl:oWnd := oWnd } )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 05:13 PM
Dear Antonio,

thanks for your advice. I tried your code but it gives me an Error FiveWin/3 Cannot create Dialog Box: Resource: START
Code (fw): Select all Collapse
Stack Calls
===========
   Called from: .\source\classes\DIALOG.PRG => CREATEDLGERROR( 717 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 306 )
   Called from: svp.prg => GETCONTROLS( 295 )
   Called from: svp.prg => (b)MAIN( 40 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1083 )
   Called from: svp.prg => MAIN( 40 )


Now I do configure my start window by "try 'n error" with @ y, n ...
And take it as a training for design :-)

-Detlef
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 05:20 PM
Detlef,

For the above example you have to use this RC:
Code (fw): Select all Collapse
#include "windows.h"

MyDialog DIALOG 32, 18, 236, 118
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "DIALOG"
FONT 6, "MS San Serif"
BEGIN
   RTEXT "Name"      , -1, 3,   5, 41, 8
   RTEXT "Level"     , -1, 3,  61, 41, 8
   EDITTEXT 10, 45,  59,   12, 12
   RTEXT "Date"      , -1, 3,  75, 41, 8
   EDITTEXT 20, 45,  73,   36, 12
   RTEXT "Notes"     , -1, 100,  89, 41, 8
END
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 06:40 PM

Dear Antonio,

now your example works fine.
I'll try to use it for my app.
Sorry for troubling you.

-Detlef

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 07:38 PM

You have to REDEFINE your controls in the dialog creation as usual

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 07:57 PM

Detlef,

You may also consider of using a Xbrowse as setup Dialog/Window designer.

All coordinates can be filled/change at runtime and this way the recompile of prg etc.. is not needed.

Button, Position, action, visuals, can be in the Xbrowse and in the program a loop while create the dialog.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM

Re: Dlg2Wnd

Posted: Tue Apr 12, 2022 09:09 PM

Thanks, Marc.
I'll try this.

-Detlef

Continue the discussion