Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
157 user(s) are online (83 user(s) are browsing Forums)

Members: 0
Guests: 157

more...

Headlines

 
  Register To Post  

MUI problem - how to make a custom button? (sort of solved)
Home away from home
Home away from home


See User information
I believe it should be possible to make my own custom buttons in MUI, but the documentation seems rather lacking on this subject.

I want a button which contains an ImageObject & a Label. Of course I can group them together... but how do I turn it into a button? I guess I need to add some kind of "button frame" & "button background", and somehow imbue it with clickable behaviour, but I haven't a clue where to start. The SimpleButton() macro doesn't expand to anything that would help me here.

Help!


Edited by ChrisH on 2011/8/31 21:23:24
Author of the PortablE programming language.
Go to top
Re: MUI problem - how to make a custom button?
Home away from home
Home away from home


See User information
Made some progress: The CheckMark() macro gave me a few hints, and the MUI_Area doc had most of the answers... horribly spread through-out it. Seems like the following should work (but gives rather ugly buttons & currently doesn't show any image for some reason) :
ChildbuttonObject := GroupObject,
    
MUIA_Background,MUII_ButtonBackMUIA_Frame,MUIV_Frame_ButtonMUIA_InputMode,MUIV_InputMode_RelVerify,
    
MUIA_Group_Columns,2,
    
ChildImageObjectMUIA_Image_Spec,"5:tbimages:quit"End,
    
ChildLabel2(label),
End


edit: OK, I am stumped why the image isn't being shown :(


Edited by ChrisH on 2011/8/30 19:12:37
Edited by ChrisH on 2011/8/30 19:44:24
Edited by ChrisH on 2011/8/30 20:17:42
Edited by ChrisH on 2011/8/31 10:53:54
Author of the PortablE programming language.
Go to top
Re: MUI problem - how to make a custom button?
Just popping in
Just popping in


See User information
Quote:

MUIA_Pressed,MUIV_InputMode_RelVerify


This is wrong. You should not set it and value you set is wrong.

No idea why it is not showing an image but I am always usint Dtpic.mui class.

You can also turn it into custom class. This allows better control (i.e. tinting selected image state).

Go to top
Re: MUI problem - how to make a custom button?
Quite a regular
Quite a regular


See User information
I know nothing about MUI, but as a casual observer what is the 5 colon in front of the AISS path and filename for?

Go to top
Re: MUI problem - how to make a custom button?
Home away from home
Home away from home


See User information
"5:" tells MUI it should load an image using datatypes, rather than using some other kind of source for the image.

Author of the PortablE programming language.
Go to top
Re: MUI problem - how to make a custom button?
Home away from home
Home away from home


See User information
@porthan
You are right. I've removed that from my code (and my first post)... but it didn't help my problems (unsurprisingly).

Author of the PortablE programming language.
Go to top
Re: MUI problem - how to make a custom button?
Home away from home
Home away from home


See User information
@all
I eventually came to the conclusion that ImageObject is simply buggy/broken, and does not work with images loaded via datatypes. Instead I got it mostly working using the Dtpic class:
ChildbuttonObject := GroupObject,
    
MUIA_Background,MUII_ButtonBackMUIA_Frame,MUIV_Frame_ButtonMUIA_InputMode,MUIV_InputMode_RelVerify,
    
ChildGroupObjectMUIA_Group_Horiz,MUI_TRUE,
        
MUIA_Frame,MUIV_Frame_None,
        
ChildDtpicObjectMUIA_Dtpic_Name"tbimages:quit"End,
        
ChildFreeLabel(label),
        
ChildRectangleObjectMUIA_InnerLeft,0MUIA_InnerRight,0MUIA_InnerTop,0MUIA_InnerBottom,0End,
    
End,
End

For some stupid reason the button frame is inherited by everything inside it, and the only way to stop that is to have a second group (!) which explicitly has no frame. Seems crazy, but I couldn't find another way to do it.

It still doesn't look 100% perfect (kinda looks like I have a double frame) but just about good enough.


Oh yeah, and MUI's Dtpic documentation seems to be literally non-existant. The only way to work out how to use it was by a few snippets of code on the web. MUI 3.8 doesn't even include everything needed to use it in the includes, as I had to declare MUIA_Dtpic_Name = 0x80423d72 (and for consistency I also declared DtpicObject using MUIC_Dtpic).

Edit: I was able to duplicate Dtpic's functionality using BitmapObject, but all the extra code doesn't seem to offer any benefit, so I might as well stick with Dtpic.


Edited by ChrisH on 2011/8/31 22:58:28
Edited by ChrisH on 2011/8/31 23:00:59
Edited by ChrisH on 2011/8/31 23:04:40
Author of the PortablE programming language.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project