ButtonTiles Class

I have added a source only example.

Example.cwproj
Example.sln
Example.clw

Just pulled it from the generated ABC with a few simplifications. Hopefully that will get you going!

That is great!, thank you !

1 Like

I get “illegal character” on all first lines
eg.
MEMBER() <---- illegal character
MAP
END
INCLUDE(‘BaseWindowComponent.inc’),ONCE

MEMBER() <---- illegal character

MAP
INCLUDE(‘CWUTIL.INC’),ONCE
END

the same for
),once <---- in the include section

Didier

Oh, could be the way github does linefeeds. I have updated the gitattributes and it should work now.

Brahn,
Perfect now.

Didier
PS: I’ll make a template for me to make it easier to modify existing apps

1 Like

I have updated this now to be, I think, much cleaner. I have also added a “Toggle Tiles” feature where you can define a set of tiles to act as a group, kind of like an option control. Checkout the screenshots and give the updated example app a go!

  • The calculations for laying out the tile icon and prompt are much simpler and more consistent.
  • The tiles now work with both icon and prompt or just icon or just prompt. If there is only an icon then it is centred. If there is only text then it is also correctly centred!
  • Tile prompts copy all font attributes from the original button and also refresh to reflect any runtime changes!
  • Tiles refresh position and size automatically. The example app window is resizable, give it a go and see it in action.
  • Class refactored into two classes, ButtonTile and TileManager. You set it up like this:
  Tiles.Init(SELF)

  Tiles.AddButtonMimic(?ButtonUsers_TEXT, 0C67200h)
  Tiles.AddButtonMimic(?ButtonDashboard_TEXT, 0998500h)

The signature of these methods is:

Init                      PROCEDURE(WindowManager pWM, BYTE pLightenOnHoverPercentage=33, BYTE pPadding=8)
AddButtonMimic            PROCEDURE(SIGNED pButtonFEQ, LONG pColor, <BYTE pLightenOnHoverPercentage>, <BYTE pPadding>)

As you can see, you can optionally set the additional parameters for the set of tiles as well as override individual tiles as needed.

The “toggle” tiles are setup like:

  ToggleTiles.enableToggleSet = TRUE
  ToggleTiles.Init(SELF, 100)
  ToggleTiles.AddButtonMimic(?ButtonUsers_TOGGLE, 0C67200h)
  ToggleTiles.AddButtonMimic(?ButtonDashboard_TOGGLE, 0C67200h)
  ToggleTiles.AddButtonMimic(?ButtonDownload_TOGGLE, 0C67200h)

All this can be seen in the example app of course.

If you have any ideas or changes you are most welcome to fork and submit a pull request for consideration, that would be awesome!

Design Time

Run Time

Example app is found here:

Oh @dgleduc, I did not see your screenshot before. Nice one!
Hopefully the update will drop in ok for you. I am not sure exactly how backward compatible it will be but it should not be too complex to switch over.

I will let you know about the update.
for the screen, 3 different images on the main frame and text with orientation and effects.(my own template and classes)

1 Like

Works ok on my apps after update.
I did not tried the demo though

1 Like

Hello - I’m trying the source example and it compiles fine. However at run-time, the image looks little distorted.

Yeah, weird!

I am not sure if it is the RTL or if it is Windows but when I run the example in a text virtual machine (Win-Vista) I see the same symptoms.
I tried a few different images and a PNG file seems to be the cleanest but still has weirdness. See image:

My best guess at the moment is that Win10 is better at scaling the ico/image files somehow?

I also tried setting a specific width/height to the image control but no luck with that either.

Quite annoying!

Perhaps some more fiddling around with image types/dimensions will find something that works more consistently?
Could it be a bug in the Clarion RTL?

Hello Brahn,

I stumbled across this ButtonTileClass, its a really nice one.

Is there a chance to have a demo being an .APP - for dumbos like me?

Or maybe another topic, like “How to make and run a Clarion-project being a non-APP”, to solve that once and for all times. :smiley:

UPDATE:
I downloaded all these .CLW and .CWPROJ and all other stuff one by one, but when I tried to open the .SLN or the .CWPROJ, I got “This is not a valid Clarion Projectwhatever-file” error.

I do a mistake, apparently. Hence my favor of .APP… :smiley:

tia
Wolfgang

Good idea! Perhaps also as part of that a series on using git too :slight_smile:
The problem with apps is backwards compatibility so, like you say, better to solve the root problem. I will try to get something started tonight.

oh yes, oh yes, oh yes!

1 Like

Ok, I made a start:

How To: Create a Non-App Clarion project?

I will update here as I add more. Of course if anyone else wishes to contribute please do! I recommend using the docs category for now. If we get a bunch of these and it makes sense then we can look at creating a more specific category.

Gah, I made the other one too!

How To: Open a Non-App Clarion project?

@brahn

I’m having some issues implementing this in a multi dll solution.

Your example works fine.

It works fine in the data dll but the moment I include it in one of the other dlls I get compiler errors.

I’ve done the include in the App’s global includes which is fine.

INCLUDE('ButtonTile.inc'),ONCE
INCLUDE('TileManager.inc'),ONCE

The moment I implement the object in the procedure

Tiles           TileManager

I’m getting these compiler errors.

Unresolved External TYPE$TILEMANAGER 
Unresolved External VMT$TILEMANAGER 
Unresolved External CONSTRUCT@F11TILEMANAGER 
Unresolved External DESTRUCT@F11TILEMANAGER 

Any thoughts?
Bertus

Probably need to set the link and dll attributes in the class properly. I was lazy and hard coded them because I was using it in a single exe. Submit a PR to the github repo if you can!

Oh wait, I just looked and they use the _ABCLinkMode_ and _ABCDllMode_ so that should work. Do you have those defines? Which version of clarion?

It’s the latest release of C10 12799. I have those defined. If got another class which I wrote for auto completing with the same defines and that is working without problem.

The other strange thing I found is that your classes are not showing up in the ABC Class Viewer. I did move it to the Clarion10\accessory\libsrc\win folder.

The only reference I’m getting on VMT is the Virtual method table in Russ’ Book: https://books.google.com.au/books?id=Loo8iIBDOdcC&pg=PA36&dq=CLARION+VMt&hl=en&sa=X&ved=0ahUKEwihjffqpvDbAhUIx7wKHfwwBiUQ6AEIKTAA#v=onepage&q=CLARION%20VMt&f=false