|
Post by Prospero on Jan 9, 2004 17:42:05 GMT
Mostly copy & pasted from the BlitzCoder forum thread with the same general theme I've figured out how to act on gadget events and also now how to change the image in an imagebox. But, I'm having trouble. I can use GUI_SetVal() to change the image, but in some cases it's causing errors, and I don't see exactly why. The scenario is that I have a panel of ImageButtons that represent the tool palette - clicking on one of them will alter either the primary or secondary pen (depending on whether it was clicked by LMB or RMB). After this, the pen display ImageBoxes get updated with the new tool image. Yappy, hopefully you have some suggestion of what might be going on here... * SetVal() with a image the ImgBox hasn't held before usually works fine, but can cause an error at line 833 in XUser.bb. * SetVal() with the same image as the ImgBox currently holds will always cause an error at line 833 in XUser.bb. * SetVal() with an image the ImgBox has held before causes an error at line 526 in XGfx.bb. All errors are the same - Image does not exist. Also, I'm still trying to figure a way of displaying an ImageBox with no border whatsoever. Best I can get right now is a black border written over the outer edge of the image... Thanks in advance for any advice!
|
|
Qcat
New Member
Posts: 2
|
Post by Qcat on Jan 9, 2004 21:35:42 GMT
I have been having the same problems with Xlnt has I have not had chance to look @ this problem yet. So any advice wood be much appreciated
Thanks Qcat
|
|
|
Post by binarymoon on Jan 10, 2004 10:46:42 GMT
Don't know if this helps. But the way I do this is to draw to the current image then use the refresh gadget command. Something like (in pseudo code)
setbuffer current_image drawimage new_image gui_refreshgad(imagebox)
|
|
Qcat
New Member
Posts: 2
|
Post by Qcat on Jan 10, 2004 12:50:58 GMT
Thanks binarymoon. Problem solved ;D
|
|
|
Post by Prospero on Jan 10, 2004 13:19:40 GMT
Still having trouble I'm trying to use Select PriPen Case T_QSAND SetBuffer ImageBuffer(imgToolPriPen\img) DrawImage QSand, 0, 0 SetBuffer BackBuffer() GUI_Refresh(winToolPalette) End Select
And it won't work. imgToolPriPen is the ImageBox I'm trying to update. Using this code it complains that the 'Variable must be a type' at the SetBuffer command. Removing the \img from imgToolPriPen runs the program, but causes an 'Image does not exist' error, again at the SetBuffer line.
|
|
Kefir
New Member
Posts: 12
|
Post by Kefir on Jan 10, 2004 16:27:07 GMT
if you use imgToolPriPen = GUI_IMAGEBOX(...) then imgToolPriPen hold the handle of ImageBox. To access to the ImageBox fields you can do this:
imgToolPriPenObj.GAD = Object.GAD(imgToolPriPen); !!! Select PriPen Case T_QSAND SetBuffer ImageBuffer(imgToolPriPenObj\img); !!! DrawImage QSand, 0, 0 SetBuffer BackBuffer() GUI_Refresh(winToolPalette) End Select
|
|
|
Post by Prospero on Jan 10, 2004 18:20:47 GMT
Thanks Kefir, that works funkily - but I think after all that I'll draw the pen icons directly onto the window rather than wasting resources with another two ImgBoxes Talking about direct window drawing, you mentioned as a comment on BlitzCoder about accessing WIN\img - is the MessageBox plugin example available for XLnt 2? I can't see it included by default, and couldn't find any mention of it on BC or anywhere else... |EDIT| Ah, no worries, I figured it out ;D |EDIT
|
|
Kefir
New Member
Posts: 12
|
Post by Kefir on Jan 11, 2004 5:49:59 GMT
You right MessageBox example not avaliable! I spoke about MessageBox plug-in in XLnt UI Editor sources.
This:
WIN.WIN = Object.WIN(WindowHandl) SetBuffer ImageBuffer(WIN\IMG) DrawImage ImageHandle, 8, 28 SetBuffer BackBuffer ()
Note: You must redraw image after you resize or refresh the window (GUI_REFRESH)
|
|