Dlg2Wnd

Dlg2Wnd

Postby Detlef » Mon Apr 11, 2022 8: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
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: Dlg2Wnd

Postby cmsoft » 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
User avatar
cmsoft
 
Posts: 1285
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Dlg2Wnd

Postby Antonio Linares » Tue Apr 12, 2022 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dlg2Wnd

Postby nageswaragunupudi » Tue Apr 12, 2022 9:45 am

Code: Select all  Expand view
DEFINE DIALOG oDlg RESIZABLE
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10619
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Dlg2Wnd

Postby Detlef » Tue Apr 12, 2022 3: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
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: Dlg2Wnd

Postby Antonio Linares » Tue Apr 12, 2022 4:41 pm

Dear Detlef,

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

Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dlg2Wnd

Postby Detlef » Tue Apr 12, 2022 5: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: Select all  Expand view
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
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: Dlg2Wnd

Postby Antonio Linares » Tue Apr 12, 2022 5:20 pm

Detlef,

For the above example you have to use this RC:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dlg2Wnd

Postby Detlef » Tue Apr 12, 2022 6:40 pm

Dear Antonio,

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

-Detlef
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm

Re: Dlg2Wnd

Postby Antonio Linares » Tue Apr 12, 2022 7:38 pm

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42059
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Dlg2Wnd

Postby Marc Venken » Tue Apr 12, 2022 7: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Dlg2Wnd

Postby Detlef » Tue Apr 12, 2022 9:09 pm

Thanks, Marc.
I'll try this.

-Detlef
User avatar
Detlef
 
Posts: 207
Joined: Mon Feb 07, 2022 9:54 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 43 guests