Forums › Forums › SIMPOL Programming › Toolbar
- This topic has 6 replies, 2 voices, and was last updated 14 years, 7 months ago by JD Kromkowski.
- AuthorPosts
- September 9, 2009 at 12:33 am #288JD KromkowskiParticipant
I really hate having to reinvent the wheel. Is there available code for a basic toolbar, i.e. selection buttons plus Table plus Current Index, plus some blank buttons ohne bitmaps to which basic functions (cut,copy,paste,printer set up,reports) can be set. Getting the proper spacing and button size, etc for the “skinny form” is kind of visually time consuming, especially when it is obvious that you’ve already created this for the Personal.
September 10, 2009 at 11:26 am #1574MichaelKeymasterJDK wrote:
> I really hate having to reinvent the wheel.
>
> Is there available code for a basic toolbar, i.e. selection buttons
> plus Table plus Current Index, plus some blank buttons ohne bitmaps
> to which basic functions (cut,copy,paste,printer set up,reports) can
> be set.
>
> Getting the proper spacing and button size, etc for the "skinny form"
> is kind of visually time consuming, especially when it is obvious
> that you've already created this for the Personal.
>The following is from the sample program that I will be releasing with
the Quick Start Guide:function buildiconbar(syscolors colors)
wxbitmap bmp, disbmp
integer e
wxtoolbar tb
wxform fe = 0
tb =@ wxtoolbar.new(16, 16, error=e)if tb !@= .nul
f =@ combos(colors)
if f !@= .nul
tb.insertform(f, name="fileindexcombos")
end ifbmp =@ wxbitmap.new("16x16_selfirst.png", "png")
disbmp =@ wxbitmap.new("16x16_selfirst_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select first
record", name="tSelFirst")
tb!tSelFirst.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_selrwnd.png", "png")
disbmp =@ wxbitmap.new("16x16_selrwnd_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select rewind",
name="tSelRwnd")
tb!tSelRwnd.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_selprev.png", "png")
disbmp =@ wxbitmap.new("16x16_selprev_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select previous
record", name="tSelPrev")
tb!tSelPrev.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_selcur.png", "png")
disbmp =@ wxbitmap.new("16x16_selcur_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select current
record", name="tSelCurr")
tb!tSelCurr.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_selnext.png", "png")
disbmp =@ wxbitmap.new("16x16_selnext_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select next
record", name="tSelNext")
tb!tSelNext.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_selffwrd.png", "png")
disbmp =@ wxbitmap.new("16x16_selffwrd_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select fast
forward", name="tSelFfwd")
tb!tSelFfwd.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_sellast.png", "png")
disbmp =@ wxbitmap.new("16x16_sellast_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select last
record", name="tSelLast")
tb!tSelLast.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_selkey.png", "png")
disbmp =@ wxbitmap.new("16x16_selkey_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select a record
by value", name="tSelKey")
tb!tSelKey.onclick.function =@ selrecbmp =@ wxbitmap.new("16x16_pageprev.png", "png")
disbmp =@ wxbitmap.new("16x16_pageprev_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Show previous
page", name="tPagePrev")
tb!tPagePrev.onclick.function =@ changepagebmp =@ wxbitmap.new("16x16_pagenext.png", "png")
disbmp =@ wxbitmap.new("16x16_pagenext_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Show next
page", name="tPageNext")
tb!tPageNext.onclick.function =@ changepage
end if
end function tbCiao, Neil
September 10, 2009 at 1:46 pm #1753JD KromkowskiParticipant1. Thanks alot.
2. By the way, there is a bug in the Personal Form Builder.
A. Create a button with a bitmap on it.
B. But then double click it in an effort to change its properties (like
the associated functions). The whole thing shuts down.So now the only way to make a change in Form Builder is to delete the
thing and start all over.3. In addition, I think that this is less a bug than something that hasn't
been completed. Or I don't know where to look. Or I think there is
something automatically happening and I want to make sure my assumption is
correct.)If you create a button with or without a bitmap, you can specify, e.g., a
function to associate with on clickBut you can't really specify a reference.
E.g.
snip
fc.onclick.function =@ Details
fc.onclick.reference =@ f
snipWhat I've come to understand by looking at the code generated by save as
dataform, is that a reference to "the form" in this case f is made
automatically.I am correctly understanding this? But I there isn't any possibility to
make the reference to anything else. Not that I have such a desire, but I
suppose that somebody might want to have the reference not be to the form
but to an application type.JDK
September 10, 2009 at 1:51 pm #1754JD KromkowskiParticipantQuestion:
September 10, 2009 at 2:30 pm #1755JD KromkowskiParticipantWhoops. Question follows but first Comment and 2 Suggestions.
There just seems to be so much overhead to do something so simple.
in main function()
wxtoolbar tb
tb =@ CreateToolBar()
tb.setwindow(w)Suggestion 1
//toolbars handled like opendataform() which I guess would be in a library
called something like ToolBarLibfunction CreateToolBar()
wxtoolbar tb
string filename
filename = "C/Simpol/IconBars/this_is_an_sxf"
integer error; error = 0
string errtext; errtext =""
tb =@ opentoolbar(filename, error=error, errortext=errtext)
end function tbSuggestion 2
function CreateToolBar()
integer e; e=0
boolean standard; standard = .true
wxtoolbar tb
// add a boolean parameter called standard
// if standard == .true, which it is by default then the standard
ToolBar
// is created
// if standard == .false, then a blank ToolBar is created andtb =@ wxtoolbar.new(16,16,error = e, standard = standard)
if you want to have a customize toolbar then you'd do this
tb =@ wxtoolbar.new(16,16,error = e, standard = .false)and proceed to use tb.insert() to create your own, e.g.
bmp =@ wxbitmap.new("16x16_selfirst.png", "png")
disbmp =@ wxbitmap.new("16x16_selfirst_disabled.png", "png")
tb.insert(bmp, disbmp, enabled=.false, tooltip="Select first
record", name="tSelFirst")
tb!tSelFirst.onclick.function =@ selrecnow to the QUESTION
> function buildiconbar(syscolors colors)
> wxbitmap bmp, disbmp
> integer e
> wxtoolbar tb
> wxform fI don't see where f is created?
It obviously must be happening in the combos function?
f =@ combos(colors)
but that code isn't here. Please advise.
And as to what creates the "colors", something like?
function Colors()
integer e
syscolors colors
sysrgb clrWindow
sysrgb clrWindowText
sysrgb clrBtnFace
sysrgb clrBtnTextcolors =@ syscolors.new()
clrWindow =@ colors.getsyscolor(COLOR_WINDOW)
clrWindowText =@ colors.getsyscolor(COLOR_WINDOWTEXT)
clrBtnFace =@ colors.getsyscolor(COLOR_BTNFACE)
clrBtnText =@ colors.getsyscolor(COLOR_BTNTEXT)
end function colorsAnd then do I also have to have a sma for the Constants, like
// Windows System Colors
constant COLOR_SCROLLBAR 0
constant COLOR_BACKGROUND 1
constant COLOR_ACTIVECAPTION 2
constant COLOR_INACTIVECAPTION 3
constant COLOR_MENU 4
constant COLOR_WINDOW 5
constant COLOR_WINDOWFRAME 6
constant COLOR_MENUTEXT 7
constant COLOR_WINDOWTEXT 8
constant COLOR_CAPTIONTEXT 9
constant COLOR_ACTIVEBORDER 10
constant COLOR_INACTIVEBORDER 11
constant COLOR_APPWORKSPACE 12
constant COLOR_HIGHLIGHT 13
constant COLOR_HIGHLIGHTTEXT 14
constant COLOR_BTNFACE 15
constant COLOR_BTNSHADOW 16
constant COLOR_GRAYTEXT 17
constant COLOR_BTNTEXT 18
constant COLOR_INACTIVECAPTIONTEXT 19
constant COLOR_BTNHIGHLIGHT 20// #if(WINVER >= 0x0400)
constant COLOR_3DDKSHADOW 21
constant COLOR_3DLIGHT 22
constant COLOR_INFOTEXT 23
constant COLOR_INFOBK 24// #if(WINVER >= 0x0500)
constant COLOR_HOTLIGHT 26
constant COLOR_GRADIENTACTIVECAPTION 27
constant COLOR_GRADIENTINACTIVECAPTION 28// #if(WINVER >= 0x0510)
constant COLOR_MENUHILIGHT 29
constant COLOR_MENUBAR 30
constant COLOR_LAST 30
constant COLOR_DESKTOP 1
constant COLOR_3DFACE 15
constant COLOR_3DSHADOW 16
constant COLOR_3DHIGHLIGHT 20
constant COLOR_3DHILIGHT 20
constant COLOR_BTNHILIGHT 20September 14, 2009 at 2:12 pm #1414MichaelKeymasterJDK wrote:
> Whoops. Question follows but first Comment and 2 Suggestions.
>
> There just seems to be so much overhead to do something so simple.
>
> in main function() wxtoolbar tb tb =@ CreateToolBar() tb.setwindow(w)
>
>
> Suggestion 1 //toolbars handled like opendataform() which I guess
> would be in a library called something like ToolBarLibActually, it can be just stuffed into a function and called during
initialization. A full example is coming toward the end of this week.As for constants, it is a good idea to use a separate file for them and
to include that file at the beginning of the program. Also, the
syscolors type is part of uisyshelp.sml (which you have the source for)
and all you need to do is to create a new object. It does the work of
preparing it. To retrieve a color from a specific index in the type, it
is easiest to use the symbolic constants found in uisyshelphdr.sma.Ciao, Neil
September 14, 2009 at 8:30 pm #1758JD KromkowskiParticipantWell, we'll see about the stuffing it in a function thing when we see it
but in the interimthe wxform f (which I presume holds the combo boxes for the current table
and current index is created here:f =@ combos(colors)
but that code:
function combos(colors)
end functionwasn't posted. Please advise.
JDK
- AuthorPosts
- You must be logged in to reply to this topic.