sGUI

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

What you want implant? A sizing symbol?
Right,some sizing symbol.I added closing symbol 'X' as arrow 4, so sizing symbol would be as arrow 5 (ascii or drawn double broken line ( like diagonal half edged arrow ) or drawn overlapped symbols '>' and '<')
Arrow 4+5 temporarily placed among arrows, but seems as logical choice for me.
"X" and "\" are necessary symbols for closing & resizing widgets.Last maybe arrow 6 as maximize symbol.
Needed parts for resizing MLeditBox are:
- to add Resize symbol - Done. ("X" just for testing)
- to get it working - Not working after clicking it
- detect mouse in move by variable 'mouseMoved'
- detect LMB pressed, holded
- when detected this => composed gadget resized, updated, redrawn.
added code

Code: Select all

function AddMultiLineEditBox(...)
function=0
dim as Gadget ptr gad,editbox, arrowResize
(...)
  		if gad->subevent then
        editbox=AddMLEBGadget(gad->subevent,PosX,PosY,BoxWidth-15,BoxHeight-15,DisplayMode)
      	AddScrollBar(gad->subevent,PosX+BoxWidth-15,PosY,BoxHeight-15,1,1,1,NumRows,1)
      	AddScrollBar(gad->subevent,PosX,PosY+BoxHeight-15,BoxWidth-15,1,1,1,NumChars,0)
      	arrowResize= AddArrow(gad->subevent,PosX+BoxWidth-15,PosY+BoxHeight-15,4)		'my
(...)

Code: Select all

function MultiLineEditActions(gad as Gadget ptr,action as integer) as integer
  function=0
  dim as Gadget ptr editbox,vscrollbar,hscrollbar, arrowResize
  editbox=gad->subevent->GadgetList->GetFirst
  vscrollbar=cast(Gadget ptr,editbox->next_node) 
  hscrollbar=cast(Gadget ptr,vscrollbar->next_node)
  arrowResize= ??		' how looks callback ??
(...)

Code: Select all

sub MultiLineEditSubHandle(gad as Gadget ptr)
  dim as Gadget ptr editbox,vscrollbar,hscrollbar, arrowResize
  editbox=gad->subevent->GadgetList->GetFirst
  vscrollbar=cast(Gadget ptr,editbox->next_node) 
  hscrollbar=cast(Gadget ptr,vscrollbar->next_node)
  arrowResize= ??		' how looks callback ??

  'gad->subevent->xSleep(-1,0)' ein Event der als "Durchläufer" und ohne SLEEP funktioniert!!!!!!!!!!!!!!!!
  gad->subevent->LMBGadgetCheck
  if gad->subevent->GADGETMESSAGE then
    select case gad->subevent->GADGETMESSAGE
      case editbox
        ModifyScrollBar(vscrollbar,1,TO_GetLines(gad),TraceCursorLine(editbox))
        ModifyScrollBar(hscrollbar,TraceCursorPosition(editbox))
      case vscrollbar
        VScrollMLEB(editbox,GetScrollBarVal(vscrollbar))
      case hscrollbar
        HScrollMLEB(editbox,GetScrollBarVal(hscrollbar))
      case arrowResize        'detect resizing&mouse in move
        ? "ooo"			'testing
    end select
    DrawGadget(editbox)
  end if
end sub
I have troubles with 'function MultiLineEditActions' and 'sub MultiLineEditSubHandle'.
Seems as right place for resizing detecting.
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

Code: Select all

sub MultiLineEditSubHandle(gad as Gadget ptr)
dim as Gadget ptr editbox,vscrollbar,hscrollbar, arrowResize
editbox=gad->subevent->GadgetList->GetFirst'get the first control off the subevent gadget list
vscrollbar=cast(Gadget ptr,editbox->next_node)'look in editbox for successor in gadget list 
hscrollbar=cast(Gadget ptr,vscrollbar->next_node)'look in vscrollbar for successor in gadget list 
arrowResize=cast(Gadget ptr,hscrollbar->next_node)'look in hscrollbar for successor in gadget list

  gad->subevent->LMBGadgetCheck
  if gad->subevent->GADGETMESSAGE then
    select case gad->subevent->GADGETMESSAGE
      case editbox
        ModifyScrollBar(vscrollbar,1,TO_GetLines(gad),TraceCursorLine(editbox))
        ModifyScrollBar(hscrollbar,TraceCursorPosition(editbox))
      case vscrollbar
        VScrollMLEB(editbox,GetScrollBarVal(vscrollbar))
      case hscrollbar
        HScrollMLEB(editbox,GetScrollBarVal(hscrollbar))
      case arrowResize
        'your code? or an additional external sub?
    end select
    DrawGadget(editbox)
  end if
end sub
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: sGUI

Post by datwill310 »

Hay Muttonhead (and that's not an insult ;D).
sGUI's really cool! Keep up the good work!
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: sGUI

Post by leopardpm »

wow.. this is really very nice - I think I will use it for sure! Thanks Muttonhead! hope you are still around
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: sGUI

Post by leopardpm »

I see Petan, or someone was working on English Docs for using these routines... where might I find that? Also, what is the latest version with all the bells and whistles that Petan was working on (Dynamic windows, etc)? Is this still a work in progress?
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

I see Petan, or someone was working on English Docs for using these routines... where might I find that? Also, what is the latest version with all the bells and whistles that Petan was working on (Dynamic windows, etc)? Is this still a work in progress?
:D Yes, i can provide a kind of short reference for v.0.8.4 in "so called english". i'm not happy with that piece of text.
My last english lesson was in 1986 and i have forgotten so much.

For all that pimped stuff please contact petan. I have build only the base of it.

Mutton
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

sGUI - trouble

Post by petan »

@ Muttonhead
Strange problem discovered at 3 A.M. hardly sleepin' at keyboard,
Shortly - in rework of my old app I used only one 'Listbox' and then 'GetComboBoxVal' in logic loop.
Wrong combination, but no warning obtained about this mistake; 5 minutes I saw result 1 for all clicked items, then catched own bug.
Is here some way to find such logical mistakes, IDK, own sGUI error messaging ??, or additional utility to check used gadgettype and gadget itemvalues in the code ?
If not, maybe this would be good to add in sGUI manual - chapter "Troubles & solutions" f.e. ?

edit - Solved temporarily in next post
Last edited by petan on May 29, 2016 21:27, edited 1 time in total.
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

@ leopardpm
- helpful sGUI english manual is Muttonhead's work ;)
- designer 0.5 is still in private testing.Don't worry, 0.5 is my love.(Recoding UDT to save all properties of all gadtypes, after night anabase with shooting radiobutton on old painted circle I'll add decent gads moving by 1 px only on keypress).
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: sGUI

Post by leopardpm »

Muttonhead wrote:
I see Petan, or someone was working on English Docs for using these routines... where might I find that? Also, what is the latest version with all the bells and whistles that Petan was working on (Dynamic windows, etc)? Is this still a work in progress?
:D Yes, i can provide a kind of short reference for v.0.8.4 in "so called english". i'm not happy with that piece of text.
My last english lesson was in 1986 and i have forgotten so much.

For all that pimped stuff please contact petan. I have build only the base of it.

Mutton
I can use your basic version for now (ver v.0.8.4 is what I downloaded) - so how do I obtain the english reference? My email is leopardpm <at> g m a i l <dot> com... don't worry about your english, my last German class was in 1978, though I was born there and lived there for 2 years back in 1988 & 1989 - and for all that, my German is MUCH worse than your english! As I go through and use your english reference, if I make updates or changes to it for my own notes, I will then send it back to you - not a full editing cycle, but could be helpful.

Thank you!
leopardpm
Posts: 1795
Joined: Feb 28, 2009 20:58

Re: sGUI

Post by leopardpm »

Thank you, Herr Muttonhead! already a big help in understanding the parameter values passed to the routines - Thanks!
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

084 version
Seems that routine 'GetComboBoxVal()' would to be a memberroutine for combobox gadtype only (and viceversa all the others)
I solve that problem with incorrect call temporarily by this way (warning added):
"sGUI_GadgetType.bas"

Code: Select all

type Gadget extends node
  event       as _EventHandle ptr'Zeiger auf den EventHandle dem dieses Gadget bei Erstellung zugeordnet worden ist
  sel         as integer    'Gadget Selektion
  over        as integer    'Flag, wenn 1 >>> Maus ist überm Gadget
  act         as integer    'Gadget Aktivierung
  posx        as integer    'PositionX
  posy        as integer    'PositionY
  gadw        as integer    'Gadgetbreite
  gadh        as integer    'Gadgethöhe
  caption     as string     'GadgetText / Bezeichnung
  Ctrl(15)    as integer    'Steuerungsvariablen, je nach Gadgettyp unterschiedlich oder auch gar nicht genutzt
  useextTO    as integer    'wenn 1 dann benutzen alle TO_Routinen benutzen das in extTObject verlinkte Textobjekt
  gadPS       as string*1	'text print rounding - Left,Right,Centered	'my
  gadKind     as integer    'Gadget Type				'my
(...)
"ComboBox.bas"

Code: Select all

(...)
function AddComboBox(event as EventHandle ptr,PosX as integer,PosY as integer,NumChars as integer, NumRows as integer=5) as Gadget ptr
  function=0
  dim as Gadget ptr gad
  gad=event->GadgetList->AppendNew (GadgetType)
  if gad then
    gad->event=event
  	gad->sel=0
    gad->act=0
    gad->act=0
    gad->gadKind=2			'my GadgetType flag
rem label 1 combo 2 list 3 etc.
(...)

function GetComboBoxVal(gad as Gadget ptr) as integer
  if gad->gadKind<>2 then ? "Wrong gadtype, asked for ComboBox !!":sleep	'my
	function=gad->Ctrl(15)
end function
All the rest Get/SetXYgadtype routines can be modified vice versa..
Last edited by petan on May 29, 2016 22:03, edited 1 time in total.
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

084 version
Similar fix for ListBox incorrect call of routine 'GetListBoxVal()'

IMHO this two mistaked calls of wrong routines can appears - 'GetListBoxVal()' for Combobox gadget
and 'GetComboBoxVal()' for Listbox gadget.
"ListBox.bas"

Code: Select all

(...)
function AddListBox(event as EventHandle ptr,PosX as integer,PosY as integer,NumChars as integer,NumRows as integer,DisplayMode as integer=0,ScrollBarMode 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=0
    gad->act=0
    gad->gadKind=3			'my GadgetType flag
rem label 1 combo 2 list 3 etc.
(...)

function GetListBoxVal(gad as Gadget ptr) as integer
  if gad->gadKind<>3 then ? "Wrong gadtype, asked for ListBox !!":sleep	'my
  if gad->Ctrl(1) then
    function=gad->gad(0)->Ctrl(14)
  else
    function=gad->gad(0)->Ctrl(15)
  end if
end function
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Yet another solution - the simplest, after knowing this problem
is to use suffix (CB,LB,Combo,List or similar) in a gadget name e.g. myActionXYList, helpCombo2.
Then problem is visible directly in the code

Code: Select all

(...)
GetComboBoxVal(myActionXYList)
(...)
GetListBoxVal(helpCombo2)
(...)
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

@Petan: All Get..Val() and Set..Val() can used on a wrong gagdet type.
In the german reference is a hint for this problem: don't do this !!! ok, this is not a real solution :D
generally all these routines a very redundant, i know it and i don't like it.
in earlier versions of sGUI i've played with some gadget type constants, maybe there was a reason to remove it, don't know.
so, i think, its possible to have only 2 (overloaded) routines, GetValue and SetValue for all gadgets
will think about it

Mutton
Post Reply