Results 1 to 4 of 4

Thread: DHTML Window Widget - enablecontrols

  1. #1
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default DHTML Window Widget - enablecontrols

    dhtmlwindow

    I need to find out how to fix the button controls. I added a maximize function.

    normal display window:
    'minimize <> restore' - correct

    'maximized' display window:
    'maximize <> restore' - correct

    how to put this...
    when maxed button 'max' button should display 'restore' which is correct, but when maxed window is minimized 'max butt' should display 'max' && 'min button' should display 'restore'. When minimized window is restored to maximum, min button should return to 'min' && 'max' should return to 'restore'

    Question how to access and chage the image/title of another button when function only allows funxtion(button,t) ???

  2. #2
    Join Date
    Aug 2004
    Posts
    9,889
    Thanks
    3
    Thanked 964 Times in 953 Posts
    Blog Entries
    15

    Default

    Regarding the maximize question, firstly, you may wish to read this thread, which contains some useful info on adding a maximize button to your DHTML window. With that said, are you looking to simply embed an extra control that apart from maximizes a window, also restores it (while changing the button's src to match)?
    DD Admin

  3. #3
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Thanks for the updates DDAdmin...I'll check em out.
    I have resolved all opertions including the control button changes. There are more modifications I have to make as far a resizing. Plus I've had to modifiy the t.state to work better with the new max, min and restore functions.

    I do have one other question, I might find it in the script itself...
    I need to get access to only the images within the control container how do I do that. Right now I get all images within the window. This could cause unforseen problem when using div or code input elements within the window.

    Anyway thanks for the help.

  4. #4
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    DDAdmin here are the codes for the button dynamics to use with maximize option...
    Code:
    		//--- replaces (t.state) in init function ---//
    		t.previousState="normal"
    		t.currentState="normal"
    		//-----------------------------------------------//
    	
    
    
    	enablecontrols:function(e){
    		var d=dhtmlwindow
    		var sourceobj=window.event? window.event.srcElement : e.target //Get element within "handle" div mouse is currently on (the controls)
    		if (/Minimize/i.test(sourceobj.getAttribute("title"))) //if this is the "minimize" control
    		d.minimize(sourceobj, this._parent)
    		else if (/Maximize/i.test(sourceobj.getAttribute("title"))) //if this is the "maximize" control
    		d.maximize(sourceobj, this._parent)
    		else if (/Restore/i.test(sourceobj.getAttribute("title"))) //if this is the "restore" control
    		d.restore(sourceobj, this._parent)
    		else if (/Close/i.test(sourceobj.getAttribute("title"))) //if this is the "close" control
    		d.close(this._parent)
    		return false
    	},
    	
    	minimize:function(button,t){
    		dhtmlwindow.rememberattrs(t)
    		
    		/*--- [(Button Dynamics) Edited By: DH Creation Station - 2012.02.11 - DO NOT EDIT!] -----*/
    		var buttons=t.controls.getElementsByTagName("img")
    		if(t.currentState=='maximize' && t.previousState=='normal'){
    			t.previousState='maximize'
    			t.currentState='minimize'
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Restore/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[5])
    					buttons[cs].setAttribute("title", "Maximize")
    				}
    				if (/Minimize/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[3])
    					buttons[cs].setAttribute("title", "Restore")
    				}
    			}
    		}
    		
    		if(t.currentState=='normal' && t.previousState=='normal'){
    			t.previousState='normal'
    			t.currentState='minimize'
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Minimize/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[3])
    					buttons[cs].setAttribute("title", "Restore")
    				}
    			}
    		}
    		/*----------------------------------------------------------------------------------------*/
    		//--- minimize coding goes here ---//
    	},
    	
    	maximize:function(button,t){
    		dhtmlwindow.rememberattrs(t)
    		
    		/*--- [(Button Dynamics) Edited By: DH Creation Station - 2012.02.11 - DO NOT EDIT!] -----*/
    		var buttons=t.controls.getElementsByTagName("img")
    		if(t.currentState=='minimize' && t.previousState=='maximize'){
    			t.previousState='normal'
    			t.currentState='maximize'
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Restore/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[4])
    					buttons[cs].setAttribute("title", "Minimize")
    				}
    				if (/Maximize/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[3])
    					buttons[cs].setAttribute("title", "Restore")
    				}
    			}
    		}
    		
    		if(t.currentState=='normal' && t.previousState=='normal'){
    			t.previousState='normal'
    			t.currentState='maximize'
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Maximize/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[3])
    					buttons[cs].setAttribute("title", "Restore")
    				}
    			}
    		}
    		
    		if(t.currentState=='minimize' && t.previousState=='normal'){
    			t.previousState='normal'
    			t.currentState='maximize'
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Restore/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[4])
    					buttons[cs].setAttribute("title", "Minimize")
    				}
    				if (/Maximize/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[3])
    					buttons[cs].setAttribute("title", "Restore")
    				}
    			}
    		}
    		/*----------------------------------------------------------------------------------------*/
    		//--- maximize coding goes here ---//
    	},
    	
    	restore:function(button,t){
    		dhtmlwindow.getviewpoint()
    		
    		/*--- [(Button Dynamics) Edited By: DH Creation Station - 2012.02.11 - DO NOT EDIT!] -----*/
    		var buttons=t.controls.getElementsByTagName("img")
    		if(t.currentState=='maximize' && t.previousState=='normal'){
    			t.previousState='normal'
    			t.currentState='normal'
    			//alert(	t.previousState +'\n\n'+ t.currentState);
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Restore/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[5])
    					buttons[cs].setAttribute("title", "Maximize")
    				}
    			}
    		}
    		
    		if(t.currentState=='minimize' && t.previousState=='maximize'){
    			t.previousState='normal'
    			t.currentState='maximize'
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Restore/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[4])
    					buttons[cs].setAttribute("title", "Minimize")
    				}
    				if (/Maximize/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[3])
    					buttons[cs].setAttribute("title", "Restore")
    				}
    			}
    		}
    		
    		if(t.currentState=='minimize' && t.previousState=='normal'){
    			t.previouseState='normal'
    			t.currentState='normal'
    			
    			for (var cs=0; cs<buttons.length; cs++){
    				if (/Restore/i.test(buttons[cs].getAttribute("title"))){
    					buttons[cs].setAttribute("src", dhtmlwindow.imagefiles[4])
    					buttons[cs].setAttribute("title", "Minimize")
    				}
    			}
    		}
    		/*----------------------------------------------------------------------------------------*/
    		//--- restore coding goes here ---//
    	},
    don't forget to change 'dhtmlwindow.imagefiles[*]' to match your images array that's the only editing that needs to be done within the markers. How you work your maximize and normal functions are up to you!!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •