April 19, 2024, 01:10:58 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Enable-disable window

Started by aurelCB, January 03, 2010, 09:50:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aurelCB

Hi...
Here is example about how on quick way enable or disable window.
I put it here becose i think that might be usefull for other members
who wants something like this:

all best... :)
Aurel

'MAIN SKELETON
declare "user32",EnableWindow(hWnd:int,bEnable:int),int
DEF w1:window
DEF w2:window
DEF a,b,c,d,e,f,g,h,i,j,k,l:int
DEF passwordok:int
def text:string
def password:string
password="pete"

'open main window
Window w1,0,0,500,400,@minbox,0,"Focus on...",main
setwindowcolor w1,rgb(100,100,150)

'-------------------------------------------------------
CONTROL w1,"B,A,5,5,60,20,0,1"
SETFONT w1, "MS Sans Serif", 9, 400,0,1
CONTROL w1,"B,B,5,30,60,20,0,2"
SETFONT w1, "MS Sans Serif", 9, 400,0,2
CONTROL w1,"B,C,5,55,60,20,0,3"
SETFONT w1, "MS Sans Serif", 9, 400,0,3
CONTROL w1,"B,Password,5,80,60,20,0,4"
SETFONT w1, "MS Sans Serif", 9, 400,0,4


'open password window---------------------------------
Window w2,0,0,300,200,@minbox,0,"Enter password...",main2
Setwindowcolor w2,rgb(220,220,230)
CONTROL w2,"E,,15,50,90,20,0,10"
SETFONT w2, "MS Sans Serif", 9, 400,0,10

CONTROL w2,"B,Submit password,15,80,100,20,0,11"
SETFONT w2, "MS Sans Serif", 8, 400,0,11
CONTROL w2,"B,Cancel,150,80,90,20,0,12"
SETFONT w2, "MS Sans Serif", 8, 400,0,12

Setfocus w2
EnableWindow(w1,0)

'----------------------------------
run=1
Waituntil run=0
Closewindow w1
End
'----------------------------------
Sub main
select @class
case @idclosewindow
run=0
case @idcreate
'centerwindow w1
endselect
Return
'----------------------------------
Sub main2
Select @class
case @idclosewindow
IF passwordok=1 then closewindow w2

case @idcreate
centerwindow w2

case @idcontrol
IF @controlid=11
text=GetControltext(w2,10)
IF text = password
Closewindow w2
EnableWindow(w1,1)
Setfocus w1
passwordok=1
SetControltext w1,4,"": SetControltext w1,4,text
ELSE
MessageBox 0,"Incorrect password...","Try Again(password=pete)"
ENDIF
ENDIF

IF @controlid=12
passwordok=0
Closewindow w2
Enablewindow(w1,1)
ENDIF

Endselect
Return