Text images n stuff - WinBlitz3d
Blitz3D Forums/Blitz3D Programming/Text images n stuff - WinBlitz3d
2 questions:
1) is it possible to have images on a Wb3d window? if so how? looking at blitzmax GUI, theres these things called "Canvas'" that are used for this function(i think)
2) is it possible to change the color of the font being used? for example, for text on windows i use labels, can i change the color of them?
How do you do it? the link you gave me is just to the site, i cant find any docs that would do this... what functions are used? and is there any docs on these?
1) see WB3D_BBImageToIcon() and WB3D_DrawIcon() this will enable you to place blitz images in wb3d windows. there is no 'canvas' support.
2) not possable, i did attempt this sometime back. thats what john might be thinking about.
kev
I thought you could change the colour of labels. No?
i disabled it back in beta john, there was problems with it that i never got round to fixing.
kev
Also, whats a icon strip, and how would i use it to say... put icons on a treeview gadget, the 2 last arguments of the WB3d_AddTreeViewNode() function
is
icon
The index of an icon from the loaded iconstrip.
selectedicon
The index of an icon from the loaded iconstrip, which will be displayed when the node is selected.
?
Thanks for clearing that colored text thing up. and solving the image thing
Hi Yahfree
icon strips are like blitz anim image strips. icons within the iconstrip are index'd so for example. the handle returned from WB3D_LoadIconStrip() is used when calling WB3D_SetGadgetIconStrip()
WB3D_SetGadgetIconStrip() will attach an icon strip to the passed gadget. then when adding items to a treeview using WB3d_AddTreeViewNode() the icon param is the image index you want.
kev
Anyone know the params on WB3D_DrawIcon?
seems to be 4 but i'm not sure what they are.
my guess was:
img,x,y,child
but it gives me an Invaild gadget handle error when i try it..
sorry for the necro, i havent actually tried images in windows yet, i was asking if it was possible before, but now i'm using them
Hi Yahfree
F1 is your friend, anyways the syntax is WB3D_DrawIcon(window,x,y,icon).
kev
What? i didnt know you can F1 DLL functions in blitz! Cool!
Hey, i'm trying to update text on a label, but my atempts have failed i'v tried:
WB3d_FreeGadget(label)
;Redraw
and
WB3D_SetGadgetText(label)
both don't change the visual..
freegadget gets rid of the gadget but leaves the text.. any ideas?
Well i assume its not possible, any other soulutions?
wont WB3D_SetGadgetText(label,"") work? it works fine here.
kev
somthing like this doesnt seem to work..?
Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),WB3D_GadgetWidth(WB3D_DeskTop())/2-402/2,WB3D_GadgetHeight(WB3D_DeskTop())/2-302/2,402,302)
WB3D_HideGadget RuntimeWindow_hWnd
Test = WB3D_CreateWindow("label test",WB3D_GadgetWidth(WB3D_DeskTop())/2-300/2,WB3D_GadgetHeight(WB3D_DeskTop())/2-200/2,300,200,0,0)
maketext = WB3D_CreateButton("Test1",0,0,80,20,Test,0)
maketext2 = WB3D_CreateButton("Test2",100,0,80,20,Test,0)
mytext = WB3D_CreateLabel("Testing",100,100,100,50,Test,WS_CHILD Or SS_SIMPLE)
WB3D_FlushEvents
While Not KeyHit(1)
Events = WB3D_WaitEvent()
;Watch for all events
Select Events
Case WB3D_EVENT_GADGET
selected = WB3D_EventSource()
Select selected
Case maketext
WB3D_SetGadgetText(mytext,"Test1")
Case maketext2
WB3D_SetGadgetText(mytext,"Test2")
End Select
Case WB3D_EVENT_WINDOW_CLOSE
find = WB3D_EventSource()
Select find
Case Test
End
WB3D_EndGUI()
End Select
End Select
Delay 5
Wend
WB3D_EndGUI()
End
Hi Yahfree, you dont see a change in the text of the label? as its does change here. or you see the change but old text longer than the new text is still visable?
here i see the change yet theres not a redraw to remove text thats longer than the new text being added. a work around for this although not ideal would be to hide the label, and then add the text then re-show the label again.
for example the code below, i also notice your not including 'WB3DStyles.bb'. maybe this was missed while a copy and paste was done :)
Case WB3D_EVENT_GADGET
selected = WB3D_EventSource()
Select selected
Case maketext
WB3D_HideGadget mytext
WB3D_SetGadgetText(mytext,"Test1")
WB3D_ShowGadget mytext
Case maketext2
WB3D_HideGadget mytext
WB3D_SetGadgetText(mytext,"Test2")
WB3D_ShowGadget mytext
End Select
kev
i believe its working now, i'm going to test it in the main prog, thanks for the help!
Edit: confirmed it works, the problem was i wasnt showing/hiding
Thanks yet again kev
a bit off topic, but i'm looking for a function that returns the text of a said gadget item in a listbox.
like consider the contents of this listbox:
firstitem
seconditem
thirditem
is there a function that would return the handle of firstitem? so i can translate that into a string?
eg.
Not Real function:
wb3d_GetGadgetTextByIndex(mylistbox,1)
would return "firstitem"
i want to be able to use a for next loop:
For i=1 to WB3D_CountGadgetItems(mylistbox)
;NOTREALNOTREALNOTREAL:
wb3d_GetGadgetTextByIndex(mylistbox,i)
Next
does such a function exist? or is there a way to get this information so i can create my own function?
Hi Yahfree.
WB3D_GadgetItemText() returns the string contained in the gadget item index.
For i=1 to WB3D_CountGadgetItems(mylistbox)
print WB3D_GadgetItemText(mylistbox,i)
Next
kev
Wow thanks for the quick reply, and sorry for the late one :D
i'll try that thanks!