Win32LIB question

new topic     » topic index » view thread      » older message » newer message

posted by: shenpen at freemail.hu

Hi all,

thanx to Rob for the answer.

Now I started to make a GUI library, which enables one create GUI with
very little code. It's basic logic is that many applications want to display
something in lines (files in an archive etc.) and some menus to do something with
it, and thus a standardized "browse window" can be created very easily. I ran
into a seemingly serious problem, so I created a very simple scenario that show
the main logic of this concept. My problem is commented in the code. Could anyone
help a bit?

-- start of include file
include win32LIB.ew
global function CreateWindowWithMenu(sequence Menu)
  sequence retval
  retval={}

  retval=append(retval,{}) -- will contain the window handle 
  retval[1] = createEx( Window, "Something", 0, Default, Default,  
  800, 600, {WS_DLGFRAME, WS_SYSMENU, WS_MINIMIZEBOX},
 {WS_EX_DLGMODALFRAME} ) -- window handle is now in retval[1]

  retval=append(retval,{}) -- will contain the data of the menu
  retval[2]=append(retval[2],createEx( Menu, Menu[1], retval[1], 0,  
  1, 0, 0, 0, 0 )) -- menu handle is now in retval[2][1]
  retval[2]=append(retval[2],Menu[2]) -- routine name is
                                      -- now in retval[2][2] 
 
  return retval
end function

procedure OnClickMenu(integer self, integer event, sequence params)
  sequence routinename
  routinename="???????????????"
  call_proc(routine_id(routinename),{})

  -- it's my problem: how to find the routine name? It's stored in
  --  the return
  -- value of the previous function, and also available from the 
  -- next one but not from here!

end procedure

global procedure RunWindow(sequence WindowToRun)     
  -- routine name is available here as WindowToRun[2][2] but
  -- it can't be used here, I think
  setHandler(WindowToRun[2][1], w32HClick, routine_id("OnClickMenu"))
  WinMain(WindowToRun[1],Normal)
end procedure

--------- end of include file, main program ---------------------

procedure RunThisProcedureWhenMenuIsClicked()
  -- do something
end procedure

sequence myWindow
myWindow=CreateWindowWithMenu( 
                        {"Menu1","RunThisProcedureWhenMenuIsClicked"} 
                    )

RunWindow(MyWindow)

-----------

My problem is that how do I put the routine name to the ????-s.

I hope you like logic of this stuff - I think it will be a nicely usable thing
if I get through the obstacles.

Thanxalot,

Miklos Hollender

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu