Re: Key Press to have Window "reappear ??

new topic     » goto parent     » topic index » view thread      » older message » newer message
Selgor said...

I must be doing it all wrong.

It seems you are not yet an experienced programmer because the reason your code is NOW not working is very obvious. I'm sorry that my example code was not clear enough.

Your code should be looking more like this ...

include win32lib.ew  
without warning  
  
constant  Win  = createEx(Window, "", 0, 220, 150, 690, 45, 
                             {WS_POPUP, WS_DLGFRAME},  
                             WS_EX_PALETTEWINDOW) 
integer x 
sequence IconId 
IconId = {} 
 
sequence command_data 
command_data =  
  { 
    {"c:\\windows\\system32\\control.exe", "c:\\im\\icos\\c.ico" , "Control Panel"}, 
    {"c:\\checkdisk\\checkDisk.exe", "c:\\im\\icos\\cd.ico", "Check Disk"}, 
    {"c:\\Program Files\\Directory Lister\\DirLister.exe", "c:\\im\\icos\\dl.ico", "Dir Lister"}, 
    { "", "c:\\im\\icos\\ed.ico", "Erase CD-DVD"}, 
    { "", "c:\\im\\icos\\f2p.ico", "Folder 2 My PC"}, 
    { "", "c:\\im\\icos\\pif.ico", "PastIconFlusher"}, 
    { "", "c:\\im\\icos\\rm.ico", "Ram Monitor"}, 
    { "", "c:\\im\\icos\\ts.ico", "Tree Size"}, 
    { "", "c:\\im\\icos\\wfe.ico", "Fonts on PC"}, 
    { "", "c:\\im\\icos\\wk.ico", "Win Hot Key"} 
  } 
  
setWindowBackColor(Win, 0027110 )  
 
x = 5 -- The X position of leftmost icon. 
for i = 1 to length(command_data) do 
    IconId &= create( Icon, "", Win, x, 5, 32, 32, 0) 
    x += 40 
    setIcon( IconId[$], command_data[i][2]) 
    setHint( IconId[$], command_data[i][3]) 
end for 
 
procedure WinKey(integer self, integer event, sequence parms)  
    -- Check for key presses.  
    if parms[1] = VK_ESCAPE then  
        setCtlPosition(Win, 250, 150) -- Show it   
    end if  
end procedure   
setHandler( Screen , w32HKeyDown, routine_id("WinKey"))  
  
procedure hide_window ( integer self, integer event, sequence parms )  
    setCtlPosition(Win, -1000, -1000) -- Hide it 
end procedure 
setHandler(Win, w32HClick, routine_id("hide_window"))  
 
procedure run_it ( integer self, integer event, sequence parms )  
 
    integer cmd 
 
    cmd = find(self, IconId) 
  
    if cmd != 0 and length(command_data[cmd][1]) > 0 then  
        shellExecute ("open", command_data[cmd][1], SW_SHOWNORMAL)  
        closeApp()  
    end if 
  
 end procedure  
 setHandler(IconId, w32HClick, routine_id("run_it"))  
  
WinMain(Win, Normal)  
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu