1. Strange

Have encountered a strange situation using wxeud. The walk_dir function in euphoria is called as follows: walk_dir( path_name , routine_id("my_function") , 1 ). The code executes perfectly excepting the use of these wxeud statements within "my_function": clear_text(file_text) and write_text(file_text,"file " & fname[D_NAME]). The two calls to wxeud do nothing.. no error.. just ignored. All the other code in "my_function" executes perfectly.

To futher muddy the water, this code in "my_function", making a call to wxeud, performs as expected: set_status_text(TheStatusBar, "This dir " & fname[D_NAME}).

All three calls to wxeud execute perfectly when not used with "my_function", but then, I can not use the data needed.

If a procedure called from within "my_function" contains the same calls to wxeud, the results match that which occur (do nothing.. no error..) as when the calls to wxeud are made within "my_function".

Have tried prepending the calls to wxeud with "wx:", but obtained the same (do nothing.. no error..) results.

Please note that file_text is a wxTextCtrl, properly created.. etc.

buzzo

new topic     » topic index » view message » categorize

2. Re: Strange

buzzo said...

Have encountered a strange situation using wxeud. The walk_dir function in euphoria is called as follows: walk_dir( path_name , routine_id("my_function") , 1 ). The code executes perfectly excepting the use of these wxeud statements within "my_function": clear_text(file_text) and write_text(file_text,"file " & fname[D_NAME]). The two calls to wxeud do nothing.. no error.. just ignored. All the other code in "my_function" executes perfectly.

It looks like the problem is in walk_dir. Here's a short demo to demonstrate the problem (no wxEuphoria required):

include std/filesys.e 
 
function my_function( sequence path_name, sequence item ) 
	printf(1, "%s : %s\n", { path_name, item[D_NAME]} ) 
	return 0 
end function 
puts(1, "starting...\n") 
walk_dir( current_dir(), routine_id( "my_function" ), 1 ) 
puts(1, "done.\n") 

I've entered ticket:853.

Matt

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

3. Re: Strange

Thanks Matt..

For now I'll use set_status_text(........)

I'll build a short demo of the problem and post it here.

Buzzo

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

4. Re: Strange

buzzo said...

Thanks Matt..

For now I'll use set_status_text(........)

I'll build a short demo of the problem and post it here.

Oops. I had a directory named "*.*" and walk_dir was choking on that. Otherwise, it works for me. Here's a demo that works for me:

include std/filesys.e 
include wxeu/wxeud.e 
 
constant 
	main  = create( wxFrame, { 0, -1, "walk_dir"}), 
	panel = create( wxPanel, main ), 
	go    = create( wxButton, { panel, -1, "Go" } ), 
	file_text = create( wxTextCtrl, { panel, -1, "", -1, -1, -1, -1, wxTE_MULTILINE } ), 
	sizer     = create( wxBoxSizer, wxVERTICAL ), 
	$ 
 
add_window_to_sizer( sizer, go, 0, 0, 0 ) 
add_window_to_sizer( sizer, file_text, 1, wxGROW, 0 ) 
set_sizer( panel, sizer ) 
 
function my_function( sequence path_name, sequence item ) 
	append_text( file_text, sprintf( "%s : %s\n", { path_name, item[D_NAME]} ) ) 
	app_yield( 1 ) 
	return 0 
end function 
 
procedure on_go( atom this, atom event_type, atom id, atom  event ) 
	set_text( file_text, sprintf( "Walking %s:\n", { current_dir() } ) ) 
	walk_dir( current_dir() , routine_id( "my_function" ), 1 ) 
	append_text( file_text, "done." ) 
end procedure 
set_event_handler( go, -1, wxEVT_COMMAND_BUTTON_CLICKED, routine_id("on_go") ) 
 
wxMain( main ) 

Note that unless you call app_yield(), nothing is updated until walk_dir() finishes (which is a lot faster, of course).

Matt

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

5. Re: Strange

The matter is resolved.. using app_yield( 1 ) after each of the calls resolved the problem(s).

Where in the API documentation is app_yield( 1 ) located ?

Again, thanks Matt

Buzzo

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

6. Re: Strange

buzzo said...

The matter is resolved.. using app_yield( 1 ) after each of the calls resolved the problem(s).

Where in the API documentation is app_yield( 1 ) located ?

Again, thanks Matt

app_yield

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu