Page 1 of 2
Hide and UnHide DIALOG
Posted: Tue Nov 02, 2010 11:17 am
by unixkd
How can I hide and unhide a dialog like the screen below ?-
Re: Hide and UnHide DIALOG
Posted: Tue Nov 02, 2010 4:38 pm
by Auge_Ohr
hi,
without knowing where you Dialog come from, but i think it is the "external" Twain Dialog ?
while it is not Xbase++ you can not :hide() or :show() it if you have no "Connection" to it
like a activeX.
so you only can try Windows API SENDMESSAGE() when you have the "Handle" of the "Twain Dialog".
Re: Hide and UnHide DIALOG
Posted: Tue Nov 02, 2010 5:02 pm
by rdonnay
How is this dialog created?
Re: Hide and UnHide DIALOG
Posted: Tue Nov 02, 2010 11:35 pm
by Wolfgang Ciriack
I think, he only want to know, how he can do this with XBase/eXPress.
Re: Hide and UnHide DIALOG
Posted: Wed Nov 03, 2010 1:39 am
by unixkd
YES. I only want know how this dialog can be created in Xbase++/express++
Re: Hide and UnHide DIALOG
Posted: Wed Nov 03, 2010 8:07 am
by Tom
1. Create the dialog with all elements. Use the FIT clause at DCREAD GUI. Store the dialog size at the EVAL clause of DCREAD like this: {||aDlgSize := oDialog:DCCurrentSize()}.
2. At the Show/Hide-button, toggle a variable "lShowSettings" (.T./.F.). If "lShowSettings" becomes .T., call oDialog:DCSetSize(aDlgSize). If "lShowSettings" becomes .F., also call oDialog:DCSetSize(), but don't use aDlgSize completely. If "nLine" is the line of the first object which is to be hidden, do it this way: aDialog:DCSetSize({aDlgSize[1],nLine-1}).
3. In addition, add "HIDE {||!lShowSettings}" to all items in the "settings" area.
That's it. This may cause problems if this dialog is resizable, so use NORESIZE at DCGET OPTIONS.
Re: Hide and UnHide DIALOG
Posted: Wed Nov 03, 2010 9:26 am
by rdonnay
Tom -
I don't think your solution will work. It isn't that easy because of the Xbase++ coordinate system.
I wrote a sample that I tested. See below.
It requires putting everything in the top portion of the dialog onto a static and then moving the static before resizing.
#INCLUDE "dcdialog.CH"
Code: Select all
FUNCTION Main()
LOCAL GetList[0], oTab1, oTab2, oMemo, oMenuBar, oMenu1, oMenu2, oMenu3, ;
oDlg, lHidden, oStatic
DCMENUBAR oMenuBar
DCSUBMENU oMenu1 PROMPT 'File' PARENT oMenuBar
DCSUBMENU oMenu2 PROMPT 'Camera' PARENT oMenuBar
DCSUBMENU oMenu3 PROMPT 'Help' PARENT oMenuBar
oMemo := ''
lHidden := .f.
@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT OBJECT oStatic SIZE 66,12
@ 0,0 DCMULTILINE oMemo SIZE 50,12 PARENT oStatic
@ 0,51 DCPUSHBUTTON CAPTION 'Capture to TWAIN' SIZE 15,1.2 PARENT oStatic
@ 2,51 DCPUSHBUTTON CAPTION 'Capture to File' SIZE 15,1.2 PARENT oStatic
@ 4,51 DCPUSHBUTTON CAPTION 'Update AE/AF' SIZE 15,1.2 PARENT oStatic
@10,51 DCPUSHBUTTON CAPTION {||IIF(lHidden,'Show Settings','Hide Settings')} ;
ACTION {||HideShowTabs(@lHidden,oDlg,oTab1,oTab2,oStatic,GetList)} ;
SIZE 15, 1.2 PARENT oStatic
@ 13,0 DCTABPAGE oTab1 CAPTION 'Settings' SIZE 66,12
@ 0,0 DCTABPAGE oTab2 CAPTION 'Profile' RELATIVE oTab1
@ 2,2 DCSAY 'This is the stuff on Tab Page 1' SAYSIZE 0 PARENT oTab1
@ 2,2 DCSAY 'This is the stuff on Tab Page 2' SAYSIZE 0 PARENT oTab2
DCREAD GUI FIT TITLE 'Testing Tab Hide' ;
EVAL {|o|oDlg := o}
RETURN nil
* -----------
PROC appsys ; RETURN
* -----------
STATIC FUNCTION HideShowTabs( lHidden, oDlg, oTab1, oTab2, oStatic, GetList )
lHidden := !lHidden
IF lHidden
oStatic:setPos({10,10})
oTab1:hide()
oTab2:hide()
oDlg:SetSize({oDlg:currentSize()[1],oStatic:currentSize()[2]+75})
ELSE
oStatic:setPos({oStatic:currentPos()[1],oTab1:currentSize()[2]+30})
oTab1:show()
oTab2:show()
oDlg:SetSize({oDlg:currentSize()[1],oTab1:currentSize()[2]+oStatic:currentSize()[2]+95})
ENDIF
DC_GetRefresh(GetList)
RETURN nil
Re: Hide and UnHide DIALOG
Posted: Thu Nov 04, 2010 9:25 pm
by TWolfe
If you just want to hide the dialog for a while why not just move it off the active desktop. It is much faster to move the dialog than to 'hide / unhide', it also avoids any sizing issues.
Just a thought,
Terry
Re: Hide and UnHide DIALOG
Posted: Fri Nov 05, 2010 4:15 am
by unixkd
Hi Roger/ ALL for your solutions.
You can download the trial version of this small twain driver software from
www.akond.net install it and just run it as a standalone program to see fully how the dialog behave so that your can adjust you sample solution more appropriately.
Re: Hide and UnHide DIALOG
Posted: Fri Nov 05, 2010 8:18 am
by rdonnay
I guess we were misunderstanding what you are asking for.
Tom and I thought that you were trying to make an eXpress++ dialog similar to the Twain dialog and hide the tabpages only.