Resizing Gadgets using the Larger Size/Smaller Size Button

mcheek

New member
Local time
8:16 AM
Messages
5
I'm wanting to resize my gadget I developed with the Larger Size/Smaller button. Currently, I have two separate main gadget html files. The only difference between them is the background image, size, and the orientation of the icons.

I noticed other built-in gadgets like Weather and CPU meter have this option, but I do not know how to adapt that to my gadget

I attached screen shots of my gadget (both have the flyout showing) so you can see the size difference.
 

Attachments

  • largetSizeButton.png
    largetSizeButton.png
    1.7 KB · Views: 2,686
  • iMonScreenShot.png
    iMonScreenShot.png
    152.3 KB · Views: 130
  • bigiMonScreenShot.png
    bigiMonScreenShot.png
    111.8 KB · Views: 84

My Computer

OS
W7 Enterprise x64

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Airbot 2.0
OS
Windows 7 Ultimate x64 SP1
CPU
Core i7 920 (D0) @ 4Ghz, *26c idle *65c full load on air
Motherboard
Asus P6X58D Premium - Sata 6Gb/s - USB 3.0
Memory
12GB DDR3 Corsair Dominator -CMD12GX3M6A1600C8 at 1600MHz
Graphics Card(s)
Zotac Geforce GTX 770
Sound Card
ASUS Xonar D2X
Monitor(s) Displays
1 LG 24" Flatron W2453V-PF 1 Samsung 24" P2450H both 2ms RT
Screen Resolution
1920x1080@60hz
Hard Drives
1 Samsung 250GB 840 Evo SSD
1 OCZ Vertex2 180GB SSD
1 TB Samsung Spinpoint F1 7200RPM 32MB cache
2 500GB WD Caviar Blacks 7200RPM 32MB cache (WD5001AALS)

Pioneer DVD Burner DVR-S18M
PSU
Corsair HX1000W
Case
Cooler Master HAF 932
Cooling
Case Fans *3 230mm, *1 140mm/CPU - *Tuniq Tower 120 Extreme
Keyboard
Logitech Wireless MK700
Mouse
Logitech Wireless MK700
Internet Speed
DL 15 Mbps UL 0.98 Mbps
Antivirus
None
Browser
Firefox Nightly
Other Info
Processor-7.7 *RAM- 7.9 *Graphics-7.9 *Gaming Graphics- 7.9 *SSD- 7.8 W.E.I final score= 7.7
*Phone- LG Nexus 5
Code:
$(document).ready(function(){
 System.Gadget.onUndock = checkState;
 System.Gadget.onDock = checkState;
 checkState();
});

I have this in my js file to execute when the gadget opens, but I'm not sure this is working.

Code:
function checkState(){
 if (!System.Gadget.docked){ 
 
  with (document.body.style)
 {
  width = "200px";
  height = "255px";
 }
 background.style.width = "200px";
 background.style.height = "255px";
 background.src = "url(img/iMonBackground200.png.png)";
 }
 
 else if(System.Gadget.docked){
  with (document.body.style)
 {
  width = "130px";
  height = "166px";
 }
 background.style.width = "130px";
 background.style.height = "166px";
 background.src = "url(img/iMonBG.png)";
 }
}


This is the rest of the code in my js file. What do I need to do in my HTML file? Do I need to get rid of the background path and let the js file assign it?


EDIT: It is working now, I had the line

Code:
System.Gadget.visibilityChanged = checkVisibility;

but no function associated with it. Got rid of the line, and it works!
 

My Computer

OS
W7 Enterprise x64
Back
Top