Re: SWITCH problem - need thoughts

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

Hallo

jessedavis said...

Version 4.01.00 Windows 7 pro
[...] cat_sel_cancel_btn are equal) it should execute this case block, printing something with "point 5" in it; however, it continues to the "case else" and now the value of the CONSTANT "cat_sel_cancel_btn" HAS CHANGED! In the following code pf() is a print procedure which does nothing but print what's in the argument. I rewrote the code to use if/elsif statements instead of using switch blocks. [...]

I tried the code below using a recent 4.0.6 and a 4.1.0 32bit on Win10 64bit
also this one

Euphoria Interpreter v4.0.1 
   Windows, Using Managed Memory 
   Revision Date: 2011-03-29, Id: 6db6dbda708d 

I can't reproduce the issue, but maybe my testcode is too different.

Andreas

include gui/tin/tinewg.exw 
include std/console.e 
 
procedure pf(atom number,sequence text) 
    puts(1,text&sprintf("%d",number)&"\n") 
end procedure 
 
procedure pp(object x) 
    puts(1,x&"\n") 
end procedure 
 
Window() 
global constant cat_sel_cancel_btn = Control(Button,"CANCEL",200,25,75,35)  
global constant cat_box = Control(DropDown,"",200,60,75,35) 
 
ListAdd(cat_box,{"Item1","Item2","Item3"}) 
 
procedure set_cat_dialog_visibility(atom vis) 
    ShowWindow(cat_box,vis) 
end procedure 
 
pf(cat_sel_cancel_btn,"line #1  point a - cancel btn => ")	 
 
--------------------------------------------------------------------------------  
  
public procedure service_category(atom box)		--box is the event owner  
							--which is the col 7 box in grid  
sequence box_txt = GetText(box)  
atom evntownr  
	pf(cat_sel_cancel_btn,"line #2  point 1 - cancel btn => ")  
	set_cat_dialog_visibility(True)  
	while True do  
		WaitEvent()			        --only two things can happen "cancel Button" or  
							--a category picked.  Everything else is ignored.  
		evntownr = EventOwner	                --a global returned by a procedure elsewhere  
		if Event = Click then  
			pf(EventOwner,"line #3  Event owner @ point 2A => ")  
			pf(evntownr,"line #4  Point 2B evntownr => ")  
			pf(cat_sel_cancel_btn,"line #5  point 2C - cancel btn => ")  
			switch evntownr do  
				case cat_box then    
					pf(cat_box,"line #6  point 3 - cat_box = ")  
					pf(evntownr,"line #7  evntownr => ")  
					-- any_key()  
					sequence cat_txt = GetItem(cat_box)  
					pp(cat_txt)  
					SetText(box,cat_txt)  
					pp(cat_txt)  
					set_cat_dialog_visibility(False)  
				case cat_sel_cancel_btn then  
					pf(cat_sel_cancel_btn,"line #8  cancel_btn @ point 5A = ")  
					pf(box,"line #9 Point 5B box = ")  
					pf(evntownr,"line #10 evntownr => ")  
					-- any_key()  
					set_cat_dialog_visibility(False)  
				case else  
					pf(cat_sel_cancel_btn,"line #11  cancel btn @ point 6A => ")  
					pf(evntownr,"line #12  Point 6B evntownr => ")  
					set_cat_dialog_visibility(True)  
					-- any_key()  
			end switch  
		end if	  
	end while  
end procedure  
 
service_category(WinHwnd) 
--------------------------------  
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu