sGUI
Re: sGUI
Quick tests of demos 085 OK
quick work with designer KO, needs a lot of job seems.
(Especially multilevel menus are beautiful, could you add the feature - highlightning item under mouse in move - also into the combobox+ listbox ?)
I'll do 085 tuning per partes as time permit, package 'll has a growing number of files, and placed on 4shared.Every new update will be messaged.
(I bought own domain a half year back, but still empty; if you prefer private eyes on tuned 085 alpha pack - moving it there, just to say..).
Today - StringGadget is going, it has the same trouble as 084 - fix OK.
Link 1
upload 22.6.2016
Link 2
https://dl.dropboxusercontent.com/u/546 ... 85test.zip
arrows+stringgadget+togglegadget+label+demo+simplegadget+listBoxGadget+combobox
checkmarkGadget - no change
BMPsimpleGadget - no change
menus - no change
quick work with designer KO, needs a lot of job seems.
(Especially multilevel menus are beautiful, could you add the feature - highlightning item under mouse in move - also into the combobox+ listbox ?)
I'll do 085 tuning per partes as time permit, package 'll has a growing number of files, and placed on 4shared.Every new update will be messaged.
(I bought own domain a half year back, but still empty; if you prefer private eyes on tuned 085 alpha pack - moving it there, just to say..).
Today - StringGadget is going, it has the same trouble as 084 - fix OK.
Link 1
upload 22.6.2016
Link 2
https://dl.dropboxusercontent.com/u/546 ... 85test.zip
arrows+stringgadget+togglegadget+label+demo+simplegadget+listBoxGadget+combobox
checkmarkGadget - no change
BMPsimpleGadget - no change
menus - no change
Last edited by petan on Jun 22, 2016 11:50, edited 12 times in total.
Re: sGUI
I want to enable ComboBoxLong; founded function GetTextWidth(txt as string, mode as integer=0) as integer; TO_GetlongestLine is the same - OK,
but How is defined 'mode' & its usage? (clear text=char*8, monospaced, proportional ?? - needed for correct tuning of gad->Ctrl(0) and BoxWidth)
edit
Founded - fontMode MUST be passed rightly & known
but How is defined 'mode' & its usage? (clear text=char*8, monospaced, proportional ?? - needed for correct tuning of gad->Ctrl(0) and BoxWidth)
edit
Founded - fontMode MUST be passed rightly & known
Last edited by petan on Apr 16, 2016 8:30, edited 1 time in total.
-
- Posts: 139
- Joined: May 28, 2009 20:07
Re: sGUI
with GetTextWidth() u get the width of a string in pixel.petan wrote:I want to enable ComboBoxLong; founded function GetTextWidth(txt as string, mode as integer=0) as integer; TO_GetlongestLine is the same - OK,
but How is defined 'mode' & its usage? (clear text=char*8, monospaced, proportional ?? - needed for correct tuning of gad->Ctrl(0) and BoxWidth)
if mode is 0 it trials to calculate the width of the text with the proportional font.
in mode 1 same with monospaced font.
Mutton
Re: sGUI
Hmm, I don't see needed function somelike 'GetLongestLineText' for ComboBoxLong (good for shorter lists.)
But for thousands items in a list seems more suitable/quicker way to add new variable for
'type TextObject extends node' e.g.longestlineID-I-Offset-or similar name and of course
to remember position in list, when longestline is changed
IDK what is better way.
But for thousands items in a list seems more suitable/quicker way to add new variable for
'type TextObject extends node' e.g.longestlineID-I-Offset-or similar name and of course
to remember position in list, when longestline is changed
Code: Select all
extends node' auskommentieren
private:
cursor as TextMark 'Hmmm ;)
firstline as TextLine ptr 'Zeiger auf erste Zeile
lastline as TextLine ptr 'Zeiger auf letzte Zeile
longestline as integer '
longestlineID as integer
(...)
IDK what is better way.
Re: sGUI
written function 'TO_GetLongestLineIndex(gadXY)', so now is known an ofset of longest text item in the list
(and text of this line therefore too).
Seeing on "Demo Combobox.bas", still it is unclear to me, what 'commander' directly sets a font mode for touched gadget.
Logically I await it as a new sGUI global parameter and gadget parameter.
And when is needed to pass another font type to gadget (for better look/contrast etc.) - this is optional gadget header parameter passed there.
So howto discover a mode value ?
(and text of this line therefore too).
Seeing on "Demo Combobox.bas", still it is unclear to me, what 'commander' directly sets a font mode for touched gadget.
Logically I await it as a new sGUI global parameter and gadget parameter.
Code: Select all
sGUI.fontMode 'new sGUI global parameter
gadgetXY->fontMode 'new gadget parameter
Code: Select all
dim as Gadget ptr cb=AddComboBox(event,10,50,160,93,fontModeXY)
(...)
'or on another place in use
gadgetXY->fontMode=fontModeXY
UpdateGadget(gadgetXY)
Re: sGUI
ComboBoxLong would be done, but two things :(
1/ there is different construction of Cbox I see - its width is decreased, IMO minus 2*minspace ??
so longestline text item is not completely displayed.
2/ value of 'GetTextWidth' for mode 0 and clear text (char=8 px) looks wrong,longestline text item is displayed badly (much shorter)
? GetTextWidth(longestLineText,1), 'OK value
? GetTextWidth(longestLineText,0) 'bad value ?? or bad font mode catched >> correct font mode parameter passing question is important for properly enabled ComboboxLong
"Demo-ComboBox.bas"
1/ there is different construction of Cbox I see - its width is decreased, IMO minus 2*minspace ??
so longestline text item is not completely displayed.
2/ value of 'GetTextWidth' for mode 0 and clear text (char=8 px) looks wrong,longestline text item is displayed badly (much shorter)
? GetTextWidth(longestLineText,1), 'OK value
? GetTextWidth(longestLineText,0) 'bad value ?? or bad font mode catched >> correct font mode parameter passing question is important for properly enabled ComboboxLong
Code: Select all
function TO_GetLongestLineIndex(gad as _Gadget ptr) as integer
function=0
dim as integer numlines,ll,llMax
dim as string tlineText
numlines=gad->TObject->GetLines
llMax=TO_GetLongestLine(gad)
if llMax>0 then
'? "numlines ";numlines
for i as integer=1 to numlines
tlineText=gad->TObject->GetLineContent(i)
' ? tlineText
ll=len(tlineText)
if ll=llMax then
' ? ll,tlineText
function=i
exit for
end if
next i
end if
end function
"Demo-ComboBox.bas"
Code: Select all
(...)
TO_AppendLine(cb,"Eintrag L")
TO_AppendLine(cb,"Eintrag M")
TO_AppendLine(cb,"Eintrag Nrjfjfjfhfhfhfh-END")
TO_AppendLine(cb,"Eintrag O")
TO_AppendLine(cb,"Eintrag P")
UpdateGadget(cb)
SetComboBoxVal(cb,7)'Eintrag G vorselektiert
dim as integer llID
dim as string longestLineText,pozisn
llID=TO_GetLongestLineIndex(cb)
? "llID ";llID
longestLineText=cb->TObject->GetLineContent(llID)
? longestLineText
? GetTextWidth(longestLineText,1), 'OK value
? GetTextWidth(longestLineText,0) 'bad value ??
cb->Ctrl(0)=GetTextWidth(longestLineText,1)
UpdateGadget(cb)
do
event->xSleep(1)
pozisn=" "+str(MOUSEX)+","+str(MOUSEY)
windowtitle " X Y <"+pozisn+" >"
if event->GADGETMESSAGE then
(...)
-
- Posts: 139
- Joined: May 28, 2009 20:07
Re: sGUI
Ok step by step:
there existing 2 internal "slots" to load a bitmap font: FontA,FontB.
FontB will allways displayed as a fixed/monospaced font, independently, what kind of bitmap font was loaded.
When a slot is emtpy the standard fb font appear instead.
U can create your own bitmap font with my font utility "charset2fbfont", should run under linux too. It converts .ttf/.otf to bmp.
FontB(monospaced) is for MultiLineEditBox,StringGadget,ListBox and ComboBox. In these controls its easier to calculate text/char posistions when all chars are having a
fixed width.
with function GetFixedWidth yout get exactly this from FontB
With sub SetFixedWidth() you can modify FontB, works only when a bitmap font was loaded
now to your problem:
take a look at Listbox.bas and Listbox_Basis.bas. Ok, there is a lot of stuff for the trashcan, i will clean that soon... :)
i had the reverse problem: how many chars can i display in a given width for the miniselector.
width of entry box (without scrollbar) = full width - 15
number of monospaced chars =int( (width of entry box - 2*minspace)/GetFixedWidth )
Mutton
there existing 2 internal "slots" to load a bitmap font: FontA,FontB.
FontB will allways displayed as a fixed/monospaced font, independently, what kind of bitmap font was loaded.
When a slot is emtpy the standard fb font appear instead.
U can create your own bitmap font with my font utility "charset2fbfont", should run under linux too. It converts .ttf/.otf to bmp.
FontB(monospaced) is for MultiLineEditBox,StringGadget,ListBox and ComboBox. In these controls its easier to calculate text/char posistions when all chars are having a
fixed width.
with function GetFixedWidth yout get exactly this from FontB
With sub SetFixedWidth() you can modify FontB, works only when a bitmap font was loaded
now to your problem:
take a look at Listbox.bas and Listbox_Basis.bas. Ok, there is a lot of stuff for the trashcan, i will clean that soon... :)
i had the reverse problem: how many chars can i display in a given width for the miniselector.
width of entry box (without scrollbar) = full width - 15
number of monospaced chars =int( (width of entry box - 2*minspace)/GetFixedWidth )
Mutton
Re: sGUI
Thanks for this help info!
Looks the font joyride 'll be the last thing in tuning, many tests needed..
(e.g. I saw strange behavior with 'SetFixedWidth()' when increasing its value - result was bigger spaces in a string, but not letters 'a-z')
Looks the font joyride 'll be the last thing in tuning, many tests needed..
(e.g. I saw strange behavior with 'SetFixedWidth()' when increasing its value - result was bigger spaces in a string, but not letters 'a-z')
Re: sGUI
085 Demo-ListBox1 + Demo-Font + Demo-toggle tried, just caught a possible problem ...
IDK if I have deleted folder 'Ubuntu/Ubuntu-R', but when this is invoked e.g. LoadProportionalFont("Ubuntu\Ubuntu-R\Ubuntu-R.bmp")
(and it's non-existing by any reason), user has no warning about it.
It's bad if I call a font file, which I don't have in the folder and no warnings obtained...
So there would be good to add a routines for
- list of available fonts and its files
- unloading fontfile
- check existency of fontfile
And modifying fontloading routines to detect missing fontfile and report it to user, if this is called.( LoadProportionalFont(),
LoadFixedFont() )
(BTW also I see missing help (F1 with messageBox, or direct print to screen ?) in some demos, where keypresses of concrete buttons
are awaited in control loop).
IDK if I have deleted folder 'Ubuntu/Ubuntu-R', but when this is invoked e.g. LoadProportionalFont("Ubuntu\Ubuntu-R\Ubuntu-R.bmp")
(and it's non-existing by any reason), user has no warning about it.
It's bad if I call a font file, which I don't have in the folder and no warnings obtained...
So there would be good to add a routines for
- list of available fonts and its files
- unloading fontfile
- check existency of fontfile
And modifying fontloading routines to detect missing fontfile and report it to user, if this is called.( LoadProportionalFont(),
LoadFixedFont() )
(BTW also I see missing help (F1 with messageBox, or direct print to screen ?) in some demos, where keypresses of concrete buttons
are awaited in control loop).
Re: sGUI
Tested 'Demo-CheckmarkGagdet' (no tuning needed for now) and got memories what I want to have in 084
It's only tip - to add new parameter e.g. 'whatFirst' =T default or L as label.It means its design
- TickBox drawn as first, or Label drawn as first
It's only tip - to add new parameter e.g. 'whatFirst' =T default or L as label.It means its design
- TickBox drawn as first, or Label drawn as first
Re: sGUI
If you want resizable MultiLineEditor, just it needs to add one more element gadget - square with '+' sign
(or similar - rhomboid..) on free place in editor (right bottom corner)
(or similar - rhomboid..) on free place in editor (right bottom corner)
-
- Posts: 139
- Joined: May 28, 2009 20:07
Re: sGUI
Hmm, at moment its static... maybe :)
Back to Checkmark:
Back to Checkmark:
Code: Select all
namespace sGUI
declare function AddCheckMarkGadget (event as EventHandle ptr,PosX as integer,PosY as integer,SwtchSel as integer,Text as string="",textleft as integer=0) as Gadget ptr
declare function CheckMarkGadgetActions(gad as Gadget ptr,action as integer) as integer
declare sub DrawCheckMarkGadget (gad as Gadget ptr)
declare sub UpdateCheckMark (gad as Gadget ptr)
declare sub CBrethinkinternal(gad as Gadget ptr)
'Ctrl(0)=Posx Checkbox
'Ctrl(1)=Posy Checkbox
'Ctrl(2)=Posx Text
'Ctrl(3)=Posy Text
'Ctrl(4)=Schalter Text links
'Ctrl(5)=Originalposition x Backup
'Ctrl(6)=Originalposition y Backup
function AddCheckmarkGadget (event as EventHandle ptr,PosX as integer,PosY as integer,SwtchSel as integer, Text as string="",textleft as integer=0) as Gadget ptr
function=0
dim as Gadget ptr gad
gad=event->GadgetList->AppendNew (GadgetType)
if gad then
gad->event=event
gad->sel=SwtchSel
gad->act=0
gad->Ctrl(4)=textleft
gad->Ctrl(5)=PosX
gad->Ctrl(6)=PosY
gad->caption=Text
CBrethinkinternal(gad)
gad->DoDraw =@DrawCheckMarkGadget
gad->DoAction =@CheckMarkGadgetActions
gad->DoUpdate =@UpdateCheckMark
function=gad
end if
end function
function CheckMarkGadgetActions(gad as Gadget ptr,action as integer) as integer
function=0
select case action
case GADGET_LMBHIT
case GADGET_LMBHOLD
case GADGET_LMBHOLDOFF
case GADGET_LMBRELEASE
if GetSelect(gad) then SetSelect(gad,0) else SetSelect(gad,1)
function=1
case GADGET_LMBRELEASEOFF
case GADGET_MOUSEOVER
gad->ctrl(13)=1
DrawGadget(gad)
case GADGET_MOUSENEXT
gad->ctrl(13)=0
DrawGadget(gad)
end select
end function
sub DrawCheckmarkGadget (gad as gadget ptr)
dim as integer CheckBoxPosx,CheckBoxPosY,TextPosX,TextPosY,GadWidth,GadHeight
CheckBoxPosX=gad->Ctrl(0)
CheckBoxPosY=gad->Ctrl(1)
TextPosX =gad->Ctrl(2)
TextPosY =gad->Ctrl(3)
GadWidth =gad->gadw
GadHeight =gad->gadh
screenlock
'OFF
gad->PutBackGround
'ON
if gad->act then
'glowfx
if gad->ctrl(13) then
FillA CheckBoxPosX,CheckBoxPosY,16,16,GadgetGlowColor,GadgetGlowFrameColor,gad->sel
else
FillA CheckBoxPosX,CheckBoxPosY,16,16,,,0
end if
if gad->sel then Tick (CheckBoxPosX+4,CheckBoxPosY+4,GadgetTextColor)
if gad->caption<>"" then drawstring (TextPosX,TextPosY,gad->caption,TextColor)
'SLEEP
if gad->act=2 then gad->PutBackGround SleepShade
end if
screenunlock
end sub
sub UpdateCheckMark (gad as Gadget ptr)
gad->PutBackGround
CBrethinkinternal(gad)
gad->SaveBackGround
DrawGadget(gad)
end sub
sub CBrethinkinternal(gad as Gadget ptr)
if gad->caption="" then 'Ohne Text
'X Y Position Gadget
gad->posx=gad->Ctrl(5)
gad->posy=gad->Ctrl(6)
'Breite u. Höhe Gadget
gad->gadw=16
gad->gadh=16
'X Y Positionen CheckBox
gad->Ctrl(0)=gad->Ctrl(5)
gad->Ctrl(1)=gad->Ctrl(6)
else 'mit Text
'Y Position Gadget
gad->posy=gad->Ctrl(6)
'Breite u. Höhe Gadget
gad->gadw=16 + minspace + GetTextWidth(gad->caption)
gad->gadh=GetFontHeight
if gad->gadh<16 then gad->gadh=16
'Y Position CheckBox
gad->Ctrl(1)= gad->Ctrl(6) + (gad->gadh - 16)/2
'Y Position Text
gad->Ctrl(3)= gad->Ctrl(6) + (gad->gadh-GetFontHeight)/2
'Text links oder rechts?
if gad->Ctrl(4) then
'X Position Gadget
gad->posx= gad->Ctrl(5) - minspace - GetTextWidth(gad->caption)
'X Position CheckBox
gad->Ctrl(0)= gad->Ctrl(5)
'X Position Text
gad->Ctrl(2)= gad->Ctrl(5) - minspace - GetTextWidth(gad->caption)
else
'X Position Gadget
gad->posx=gad->Ctrl(5)
'X Position CheckBox
gad->Ctrl(0)= gad->Ctrl(5)
'X Position Text
gad->Ctrl(2)= gad->Ctrl(5) + 16 + minspace
end if
end if
end sub
end namespace
Re: sGUI
Ya, perfect!
Maybe someone would ask for text rounding, when text is first, e.g. in field of checkgads,
but I am not a friend of holes in GUI design and this, if really needed, can be done with text array of fixed length.
Label+Demo is up, all is in one routine (084 LabelBackgrounded).There is one line of unknown sense (gad->putbackround->img) for me,
you have changes in it, so test it&fix by your new control flow.. ;)
Maybe someone would ask for text rounding, when text is first, e.g. in field of checkgads,
but I am not a friend of holes in GUI design and this, if really needed, can be done with text array of fixed length.
Label+Demo is up, all is in one routine (084 LabelBackgrounded).There is one line of unknown sense (gad->putbackround->img) for me,
you have changes in it, so test it&fix by your new control flow.. ;)
Re: sGUI
Mistake in 085 FileRequester founded, 'CLS' command clears program window..
-
- Posts: 139
- Joined: May 28, 2009 20:07
Re: sGUI
Yess, and 2 rows before we save the complete Screen in gfxbackup.
i think same in MessageBox.
my goal was a dimmed Screen when FR or MB is open
Mutton
i think same in MessageBox.
my goal was a dimmed Screen when FR or MB is open
Mutton