Buttons on meta-files

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Buttons on meta-files

Post by Marc Vanzegbroeck »

Hello,

A application that I wrote is generating drawing by using meta-files.
Then I display them and by using oMeta:blClicked := {|nRow, nCol, nKeyFlags| myfunc(nRow, nCol, nKeyFlags)} I check where the mouse is clicked, then I jump to another drawing.
I was wondering that I can use some kind of buttons, it would me easyer because than I don't calculate the area's where the mouse can be clicked. The area's are not always on the same place, and the number of areas can be different.

Thanks,
Marc
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

You can place a pushbutton on top of a metafile, the usual way:

@ ..., ... BUTTON ... OF oMetaFile SIZE ..., ... ACTION ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Thanks Antonio, it's working very nice.

Is there a way to change the color. I already used button1:color(..,..) but this seems not to work.
I use FWH707

Thanks,
Marc
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

If you need to change the buttons colors, then use a BTNBMP instead of a BUTTON:

@ ..., ... BTNBMP ... OF oMetaFile SIZE ..., ... ACTION ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Antonio,

What is the use of the 3th bitmap? The second is the one displayed while pressing the button, I never see the 3th.

Marc
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

It is shown when the button is disabled
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Antonio,

Do I have to release the buttons while ending the window with the buttons?

If I call the BTNBMP the first time, everthing is fine. The second time, the text in the buttons are missind, and the other text on the screen are bold.

I already tried oBtn:end() with no result.

Marc
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

> Do I have to release the buttons while ending the window with the buttons?

No, its not needed as they will be automatically destroyed

>
If I call the BTNBMP the first time, everthing is fine. The second time, the text in the buttons are missind, and the other text on the screen are bold.
>

Have you defined a font for the buttons ? If yes, do this: oFont:nCount++
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Post by Marc Vanzegbroeck »

Antonio,

Do I have to put this each time before creating a button like this :

Code: Select all

aadd(metatoetsen,nil)
schermfont :nCount++
@ y_cor(y+4), x_cor(x-1 ) BTNBMP metatoetsen[len(metatoetsen)] RESOURCE 'GEEL','GEEL2' PROMPT text of oMeta SIZE x_cor(52),x_cor(13) FONT schermfont action ganaarpunt(text) PIXEL

aadd(metatoetsen,nil)
schermfont :nCount++
@ y_cor(y+4), x_cor(x-11) BTNBMP metatoetsen[len(metatoetsen)] RESOURCE 'GEEL','GEEL2' PROMPT ct   of oMeta SIZE x_cor(10),x_cor(13) FONT schermfont action ganaarpunt(text) PIXEL
Marc
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Marc,

Just one call to schermfont:nCount++ should be enought
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply