Need Autorestore Window in @ .. DCDIALOG

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Need Autorestore Window in @ .. DCDIALOG

#1 Post by rdonnay »

Could you pls also integrate the Autorestore feature in Dialogs created with @ 1,1, DCDIALOG oWinDlg DrawingArea oDlg

still does not work :-(

This was sent as an email to me by Michael Rudrich.
I am posting it here so it is not forgotten.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Need Autorestore Window in @ .. DCDIALOG

#2 Post by rdonnay »

Michael -

This works for me:

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], oDlg

DC_AutoRestoreWindow( { HKEY_CURRENT_USER, 'Software\Donnay Software\eXpress++\Windows' } )

@ 0,0 DCDIALOG oDlg SIZE 300,300 PIXEL CAPTION 'My test dialog'

DCREAD GUI FIT ADDBUTTONS TITLE 'Some title'

RETURN nil

* ------------

PROC appsys ; return
The eXpress train is coming - and it has more cars.

edv-rudrich
Posts: 33
Joined: Wed Jan 27, 2010 10:23 pm

Re: Need Autorestore Window in @ .. DCDIALOG

#3 Post by edv-rudrich »

Hi..

so what is wrong with this construct??

#include "dcdialog.ch"

STATIC oDialog

Procedure APPSYS()
RETURN

Function Main()
Local oHaupt, oSub, GetOptions, ;
GetList := {}, nEvent, mp1, mp2, oXbp, oAppWindow

Public nDialogNummer := 0
GUI ON

DC_AutoRestoreWindow ({HKEY_CURRENT_USER, '\SOFTWARE\Michael\Demo\Fenster'})

// Menu
DCMenuBar oHaupt
DCSubMenu oSub PROMPT "&Action" PARENT oHaupt

DCMenuItem "&Dialog" PARENT oSub;
ACTION {|| o:=Thread():new(),o:Start("Test1",oDialog) }

DCMenuItem "&End" PARENT oSub ;
ACTION {|| PostAppEvent(xbeP_Close) }


DCGETOPTIONS WINDOWHEIGHT 480 ;
WINDOWWIDTH 640 ;
TABSTOP

DCREAD GUI TITLE 'Test++' ;
OPTIONS GetOptions ;
EVAL {|o|SetAppWindow(o),SetAppFocus(o)};
PARENT @oDialog

DC_GetDestroy(Getlist)
RETURN nil

Function Test1(oDialog)
Local oDlg, oDlgWindow, Getlist := {}, lOK := .F.
Local GetOptions, oSession
Local oTabPage1,oTabPage2, oTabPage3
Local cVar1 := space(10)
Local cVar2 := space(10)
Local cVar3 := space(10)

nDialogNummer++

@ 1,1 DCDIALOG oDlgWindow DRAWINGAREA oDlg SIZE 50,17 ;
CAPTION 'Dialog ' + strzero(ThreadId(),2) NOMINBUTTON NORESIZE

@ 1,1 DCTABPAGE oTabPage1 CAPTION 'Tab 1';
SIZE 76,17 PREOFFSET 0 POSTOFFSET 86 PARENT oDlg

@ 0,0 DCTABPAGE oTabPage2 CAPTION 'Tab 2' ;
RELATIVE oTabPage1 PARENT oDlg

@ 0,0 DCTABPAGE oTabPage3 CAPTION 'Tab 3' ;
RELATIVE oTabPage2 PARENT oDlg

@ 2,2 DCSAY "Hello 1" GET cVar1 PARENT oTabPage1
@ 4,2 DCSAY "Hello 2" GET cVar2 PARENT oTabPage1

@ 2,2 DCSAY "Hello 2" GET cVar2 PARENT oTabPage2

@ 2,2 DCSAY "Hello 3" GET cVar3 PARENT oTabPage3

DCGETOPTIONS ;
CHECKGET;
TABSTOP;
CASCADE;
HILITEGETS GRA_CLR_RED NOMINBUTTON NOMAXBUTTON NORESIZE
//AUTORESIZE

DCREAD GUI ;
parent oDialog;
OPTIONS GetOptions;
HANDLER _DlgHandler;
TO lOK

DC_GetDestroy(Getlist)

nDialogNummer--

DbCLoseAll()
DbCommitAll()

RETURN (NIL)

STATIC FUNCTION _DlgHandler ( nEvent, mp1, mp2, oXbp, oDialog, GetList )
IF nEvent = xbeP_Close
RETURN(DCGUI_EXIT_OK)
ENDIF

RETURN DCGUI_NONE


- Michael

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Need Autorestore Window in @ .. DCDIALOG

#4 Post by rdonnay »

What happens if you remove CASCADE from DCGETOPTIONS ?
The eXpress train is coming - and it has more cars.

edv-rudrich
Posts: 33
Joined: Wed Jan 27, 2010 10:23 pm

Re: Need Autorestore Window in @ .. DCDIALOG

#5 Post by edv-rudrich »

Hi (from China)

same behaviour when I remove CASCADE

- Michael

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Need Autorestore Window in @ .. DCDIALOG

#6 Post by rdonnay »

I wonder if the handler is interfering with the code that saves the coords.

You should see an entry in your registry under HKEY_CURRENT_USER\SOFTWARE\Michael\Demo\Fenster\Windows.

It will have the same name as the title (caption) of the window.
The eXpress train is coming - and it has more cars.

edv-rudrich
Posts: 33
Joined: Wed Jan 27, 2010 10:23 pm

Re: Need Autorestore Window in @ .. DCDIALOG

#7 Post by edv-rudrich »

Hi --

sorry, no entry...

- Michael

edv-rudrich
Posts: 33
Joined: Wed Jan 27, 2010 10:23 pm

Re: Need Autorestore Window in @ .. DCDIALOG

#8 Post by edv-rudrich »

Hi again:
Could you compile and run the code?
So you might find out what's wrong..

- Michael

User avatar
RDalzell
Posts: 205
Joined: Thu Jan 28, 2010 6:57 am
Location: Alsip, Illinois USA

Re: Need Autorestore Window in @ .. DCDIALOG

#9 Post by RDalzell »

Hallo Michael,

Remove the "\" from before the "SOFTWARE"

i.e.
was:
DC_AutoRestoreWindow ({HKEY_CURRENT_USER, '\SOFTWARE\Michael\Demo\Fenster'})

Should be:
DC_AutoRestoreWindow ({HKEY_CURRENT_USER, 'SOFTWARE\Michael\Demo\Fenster'})

Rick

edv-rudrich
Posts: 33
Joined: Wed Jan 27, 2010 10:23 pm

Re: Need Autorestore Window in @ .. DCDIALOG

#10 Post by edv-rudrich »

Hey Rick -

that does it!!!
Thank you..

man - what a trivial bug :-((

Thanks

- Michael

Post Reply