Page 1 of 1
Buttons on meta-files
Posted: Tue Aug 28, 2007 12:09 pm
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
Posted: Tue Aug 28, 2007 12:51 pm
by Antonio Linares
Marc,
You can place a pushbutton on top of a metafile, the usual way:
@ ..., ... BUTTON ... OF oMetaFile SIZE ..., ... ACTION ...
Posted: Thu Aug 30, 2007 4:04 am
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
Posted: Thu Aug 30, 2007 7:24 am
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 ...
Posted: Thu Aug 30, 2007 1:00 pm
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
Posted: Thu Aug 30, 2007 1:19 pm
by Antonio Linares
Marc,
It is shown when the button is disabled
Posted: Fri Aug 31, 2007 7:53 am
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
Posted: Fri Aug 31, 2007 9:26 am
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++
Posted: Fri Aug 31, 2007 12:34 pm
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
Posted: Fri Aug 31, 2007 12:49 pm
by Antonio Linares
Marc,
Just one call to schermfont:nCount++ should be enought