X1000 procedures can't access MUI elements?

This forum is for general developer support questions.
Post Reply
Spirantho
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 34
Joined: Thu Jan 26, 2012 10:54 am

X1000 procedures can't access MUI elements?

Post by Spirantho »

Hi everybody,

This I believe is probably an X1000-specific question but I don't have access to the X1000 forum.

I have a MUI program (SuperDiskImage) which reads and writes Amiga and other disk images.
I have added a Cancel button. To do this I had to spawn a new procedure to do the actual disk work.

On the non-X1000 machines, it works perfectly - the spawned procedure (CreateNewProcTags() ) changes the blocks, greys out buttons, that sort of thing.
On the X1000, it fails. The GUI doesn't update. If the window is moved around a lot, occasionally the GUI will update to the current state.

How can I make this work on the X1000?

Thanks!
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: X1000 procedures can't access MUI elements?

Post by zzd10h »

On my x1000,
it works well (for example with my MUI program FastView).

I use CreateNewProcTags and DoMethod(app,MUIM_Application_PushMethod,...) from the child process to update my MUI interface.

Is FastView (OS4depot) GUI updates the number of files found on your system when scanning images drawer ?
Is your executable program available to test on my X1000 ?
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
Spirantho
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 34
Joined: Thu Jan 26, 2012 10:54 am

Re: X1000 procedures can't access MUI elements?

Post by Spirantho »

Thanks for the help!

I'm not trying to call a MUI Method though, rather I'm just setting attributes (enabled/disabled, source colour, that sort of thing). Also it works on my non-X1000s, though of course that's no guarantee of anything.

I think if you download http://www.retroreview.com/iang/Catweas ... 130422.lha I think you should be able to see if it works. Put a filename into the file box (RAM:test or something), then click "Read Disk". It should do *something*, but I'm not sure what if you have no Catweasel. :) All I'm looking for though is for the buttons to disable when you press Read Disk, and for the Cancel button to enable. This should then revert back when the operation fails, along with a couple of coloured boxes instead of black ones.
Try and see what happens. :)
Thanks again!
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: X1000 procedures can't access MUI elements?

Post by zzd10h »

Hi,
You are welcome !

I try your program and when I click "read disk", it says me that it's illegal to call MUIM_Redraw from a child process.

It's exactly why I suggest you to try PushMethod from your child process.
edit: I had the same problem than you and Fab suggests me this method.

1) Please try, something like that

DoMethod(app,MUIM_Application_PushMethod,
My_Button,3,MUIM_Set,MUIA_Disabled,TRUE);

edit : this method works well if you have few updates to do, otherwise you will have to use signaling method.
personally, I use just a few PushMethod in FastView.

2) Do you try to see if number of files are changing when you scan image's drawer with FastView ?

http://www.os4depot.net/index.php?funct ... stview.lha



Guillaume
Last edited by zzd10h on Mon Apr 29, 2013 3:50 pm, edited 2 times in total.
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
Spirantho
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 34
Joined: Thu Jan 26, 2012 10:54 am

Re: X1000 procedures can't access MUI elements?

Post by Spirantho »

Right! That looks like what must be happening! How strange it works on one machine and not another, though.
I'll try that though and see what happens!

Thanks very much for your help, it's much appreciated!
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: X1000 procedures can't access MUI elements?

Post by zzd10h »

take care I have edited my post...
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
User avatar
tboeckel
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 68
Joined: Mon Jun 20, 2011 9:56 am
Contact:

Re: X1000 procedures can't access MUI elements?

Post by tboeckel »

Spirantho wrote:Right! That looks like what must be happening! How strange it works on one machine and not another, though.
I'll try that though and see what happens!

Thanks very much for your help, it's much appreciated!
Which MUI versions exactly are we talking about here? Older MUI 3.9 releases might allow redraw operations from other tasks than the main task. However, since November 2012 MUI will refuse to perform any redraw operations that are not done by the main application task. Thus the GUI will appear to be not being updated unless the window is resized. This is just an enforcement of one of the oldest MUI rules ever.
Spirantho
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 34
Joined: Thu Jan 26, 2012 10:54 am

Re: X1000 procedures can't access MUI elements?

Post by Spirantho »

I must be using an old version of MUI....

I made the changes suggested above, and got an oddity:

// set( gTrackField[ track ], MUIA_Bitmap_SourceColors, colour);
DoMethod(app,MUIM_Application_PushMethod, gTrackField[ track ],3,MUIM_Set,MUIA_Bitmap_SourceColors, colour);

This is the old code and the new code.
The old code works perfectly (except on newer MUI builds, it seems).
The new code does nothing (or at least nothing correct).
Should they not do the same?

Edit:
This is the complete code I have:

Code: Select all


		if ( mainThread == TRUE )
		{
        	DoMethod(grp, OM_REMMEMBER, obj);
			set( gTrackField[ track ], MUIA_Bitmap_SourceColors, colour);
	        DoMethod(grp, OM_ADDMEMBER, obj);
    	    DoMethod(grp, MUIM_Group_ExitChange);
		}
    	else
        {
        	DoMethod(app,MUIM_Application_PushMethod, grp, 2, OM_REMMEMBER, obj);
	    	DoMethod(app,MUIM_Application_PushMethod, gTrackField[ track ],3,MUIM_Set,MUIA_Bitmap_SourceColors, colour);
        	DoMethod(app,MUIM_Application_PushMethod, grp, 2, OM_ADDMEMBER, obj);
        	DoMethod(app,MUIM_Application_PushMethod, grp, 1, MUIM_Group_ExitChange );
		}
                 
Am I still doing something wrong? Thanks for all the help!
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: X1000 procedures can't access MUI elements?

Post by zzd10h »

Personaly, I never made InitChange / ExitChange (where is your qinitChange? ) ADD REMMEMBER with
PushMethod

And if you try simply to set a simple things, without ADD REMMEMBER, InitChange, ExitChange,,,
on a simple button, for example, does it works ?
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
Spirantho
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 34
Joined: Thu Jan 26, 2012 10:54 am

Re: X1000 procedures can't access MUI elements?

Post by Spirantho »

Doing simple changes work fine (disabling/enabling buttons for example). However, changing the bitmap colour changes the colour correctly the first 8 times, and then nothing happens. Run it again (different bitmaps) and again, the first 8 change correctly, then nothing.
Weird. I may have to do it by messaging but I'm wondering if this is my bug or not?
Post Reply