1. w32engin does not detect clicks when button is within a group box

In the following code, button KO is not detected and button OK is detected.

include w32engin.ew 
 
constant Win = create( Window, "myApp", 0, Default, Default, 300, 200, 0 ) 
constant Group = create( Group, "myGroup", Win, 8, 8, 260, 140, 0 ) 
constant btnKO= create( PushButton, "KO",  Group, 8, 24,  88, 20, 0 ) 
constant btnOK= create( PushButton, "OK",  Win, 16, 56,  88, 20, 0 ) 
 
procedure btnKO_onClick(sequence p) 
  puts(1, "Button KO clicked\n") 
end procedure 
onClick[ btnKO ] = routine_id("btnKO_onClick") 
 
procedure btnOK_onClick(sequence p) 
  puts(1, "Button OK clicked\n") 
end procedure 
onClick[ btnOK ] = routine_id("btnOK_onClick") 
 
WinMain( Win, Normal ) 

Is there a way to correct this behaviour?

Regards

Jean-Marc

new topic     » topic index » view message » categorize

2. Re: w32engin does not detect clicks when button is within a group box

Jean-Marc

You are correct it will not work.

I think the problem is do to the fact that the group box

is a static control and the buttons window messages are not

being exposed to the out side world. I tried this on a number

different win32lib libraries and none worked.

I just don't know how to do it.

Bernie

new topic     » goto parent     » topic index » view message » categorize

3. Re: w32engin does not detect clicks when button is within a group box

jmduro said...

In the following code, button KO is not detected and button OK is detected.

[...]

Is there a way to correct this behaviour?

Regards

Jean-Marc

Hi

I remember that I had the same problems. in tinewg a 'Group' is a 'Button' with the BS_GROUPBOX - Style set.

include tinewg.exw 
 
constant Win = Window( "myApp",-1, -1, 300, 200)  
constant group = Control( Group, "myGroup", 8, 8, 260, 140 )  
SetParentWindow(group) 
constant btnKO= Control( PushButton, "KO", 8, 24,  88, 20) 
SetParentWindow(Win) 
constant btnOK= Control( PushButton, "OK", 16, 56,  88, 20 )  
  
procedure btnKO_onClick()  
  puts(1, "Button KO clicked\n")  
end procedure  
SetHandler(btnKO,Click,routine_id("btnKO_onClick")) 
  
procedure btnOK_onClick()  
  puts(1, "Button OK clicked\n")  
end procedure  
SetHandler(btnOK,Click,routine_id("btnOK_onClick")) 
  
WinMain()  

Seems to work like expected.

Andreas

new topic     » goto parent     » topic index » view message » categorize

4. Re: w32engin does not detect clicks when button is within a group box

BRyan said...

I tried this on a number different win32lib libraries and none worked.

I just don't know how to do it.

The following also works just fine (using arwen)

-- test.exw 
include arwen.ew  
 
constant Main  = create(Window,"myApp",  0,     0,Default,Default,300,200, 0) 
constant group = create(Group, "myGroup",0,  Main,      8,      8,253, 69, 0) 
constant btnKO = create(Button,"KO",     0, group,     87,     25, 88, 20, 0) 
constant btnOK = create(Button,"OK",     0,  Main,     95,    117, 88, 20, 0) 
 
function MainHandler(integer id, integer msg, atom wParam, object lParam) 
    if wParam or object(lParam) then end if -- (suppress unused warnings) 
    if msg=WM_COMMAND then 
        if id=btnKO then 
            puts(1,"Button KO clicked\n") 
        elsif id=btnOK then 
            puts(1,"Button OK clicked\n") 
        end if 
    end if 
    return 0 
end function 
setHandler({btnKO,btnOK},routine_id("MainHandler")) 
 
WinMain(Main,SW_NORMAL) 

Pete

new topic     » goto parent     » topic index » view message » categorize

5. Re: w32engin does not detect clicks when button is within a group box

-- Around line number 20095 in w32engin.ew 
-- 
-- CHANGE THIS LINE BELOW 
-- {"BUTTON",   #50000007,#00000000}, -- Group 
-- 
-- CHANGE THIS TO READ AS FOLLOWS 
-- {"BUTTON",   #50002007,#00000000}, -- Group 
-- 
-- 
-- Use without warning to eliminate not used warning message 
-- for Group because it is a static control. 
without warning 
 
 
include w32engin.ew 
 
constant 
-- 
  Win = create( Window, "myApp", 0, Default, Default, 300, 200, 0 ), 
 
  Group = create( Group, "myGroup", Win, 8, 8, 260, 140, 0 ), 
 
  btnKO= create( PushButton, "KO",  Win, 32, 32, 88, 32, 0 ), 
 
  btnOK= create( PushButton, "OK",  Win, 32, 72, 88, 32, 0 ) 
 
atom result 
 
  procedure btnKO_onClick(sequence p) 
    p = p -- use p to elimation not used warning 
    result = message_box( "Button KO clicked", "KO MESSAGE", 0 ) 
  end procedure 
  onClick[ btnKO ] = routine_id("btnKO_onClick") 
 
  procedure btnOK_onClick(sequence p) 
    p = p -- use p to elimation not used warning 
    result = message_box( "Button OK clicked", "OK MESSAGE", 0 ) 
  end procedure 
  onClick[ btnOK ] = routine_id("btnOK_onClick") 
 
  WinMain( Win, Normal ) 
 
new topic     » goto parent     » topic index » view message » categorize

6. Re: w32engin does not detect clicks when button is within a group box

Thank you Bernie,

It works perfectly.

Regards

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

7. Re: w32engin does not detect clicks when button is within a group box

Thank you Andreas and Pete,

I played with TinEWG. If it didn't miss a few features I needed (grids as far as I remember, but I might be wrong) I would have adopted it.

I must try Arwen. It is the last one I didn't give a real try.

Regards

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

8. Re: w32engin does not detect clicks when button is within a group box

jmduro said...

I must try Arwen. It is the last one I didn't give a real try.

Let me know of anything you find missing (such as grids).

Pete

new topic     » goto parent     » topic index » view message » categorize

9. Re: w32engin does not detect clicks when button is within a group box

jmduro said...

Thank you Andreas and Pete,

I played with TinEWG. If it didn't miss a few features I needed (grids as far as I remember, but I might be wrong) I would have adopted it.

I must try Arwen. It is the last one I didn't give a real try.

Regards

Jean-Marc

Hi

tinEWG is not really maintained, since over a year. A 'Grid Control' was never on the plan ;) A full featured Grid (like in Delphi/FPC) would need more lines of code than tinEWG itself ;)

Arwen (completly ported to EU4) is a really good starting point (if i look at Edita).

But simple things could allready be done with tinEWG (a simple Directory Browser):

include tinewg.exw 
include std\filesys.e 
 
WindowType=StandardWin 
Window("DirTest") 
atom list=Control(ListView,"",0,0,390,170) 
 
lv_AddColumn(list,"Size",64) 
lv_AddColumn(list,"Attribut",64) 
lv_AddColumn(list,"Name",128) 
lv_AddColumn(list,"Path",64) 
 
atom font=NewFont("Lucida Console",12,0,0,0) 
SetFont(list,font) 
 
function addfiles(sequence path_name,sequence filename) 
atom count 
    count=lv_GetItemCount(list) 
    lv_InsertRow(list,count,path_name) 
    lv_SetItem(list,count,1,filename[D_NAME]) 
    lv_SetItem(list,count,2,filename[D_ATTRIBUTES]) 
    lv_SetItem(list,count,3,sprintf("%d",filename[D_SIZE])) 
return 0   
end function 
walk_dir("c:\\",routine_id("addfiles"),False) 
 
procedure listclick() 
atom index 
sequence fullname 
    index=lv_GetIndex(list) 
    fullname=lv_GetItem(list,index,0)&"\\"&lv_GetItem(list,index,1)&"\\" 
    -- puts(1,fullname&"\n") 
    if equal(lv_GetItem(list,index,2),"d") then 
        chdir(fullname) 
        lv_Clear(list) 
        lv_InsertRow(list,0,"..") -- dummy for cd .. 
        lv_SetItem(list,0,2,"d")  -- dummy for cd ..  
        walk_dir(current_dir(),routine_id("addfiles"),False) 
    elsif equal(lv_GetItem(list,index,2),"a") then 
	RunApp(fullname,"") 
    end if 
end procedure 
SetHandler(list,DClick,routine_id("listclick")) 
 
WinMain() 
 

Andreas

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu