sGUI

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

I will check this...

As far as i remember... the Combobox reacts on changing the selection. Means if first entry was selected nothing will happen when reselected
Thiis behavior was my intension. I will see what i can do to change it

Mutton

Edit:

open ComboBox.bas and replace ComboBoxActions function

Code: Select all

function ComboBoxActions(gad as Gadget ptr,action as integer) as integer
  function=0
  dim as integer result
  select case action
    'case GADGET_HIT,GADGET_HOLD,GADGET_HOLDOFF,GADGET_RELEASE,GADGET_RELEASEOFF
    case GADGET_HIT,GADGET_HOLD,GADGET_RELEASE
    gad->subevent->GadgetControl
      gad->Ctrl(14)=gad->Ctrl(15)
      if gad->subevent->GADGETMESSAGE then
        select case gad->subevent->GADGETMESSAGE
          'case gad->gad(0)
            'nichts
          case gad->gad(0),gad->gad(1)
            result=MiniSelector(gad->posx,gad->posy + Fontheight+6 ,gad->Ctrl(0),gad->Ctrl(1),GetTOAddress(gad->gad(0)),gad->Ctrl(15))
            if result then
              gad->Ctrl(15)=result
              gad->gad(0)->Ctrl(15)=result
              UpdateGadget(gad) '<-----!!!
              function=1        '<-----!!!
            end if
        end select
      end if
      'if gad->Ctrl(14)<>gad->Ctrl(15) then
      '  UpdateGadget(gad)
      '  function=1
      'end if
  end select
end function
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Problem temporarily bypassed, but not solved. Solved now
Quick gap is default set combobox item to zero, so nothing is printed in gad box.
Then click on any item is catched, but no next clicks on the same item ...

Code: Select all

SetComboBoxVal(editOld,0)
Minislector is OK, problematic is filling event->GADGETMESSAGE;
what are internal rules to gadget's pointer returning, Mutton ?
I simply think (but may be wrong, no GUI principles known to me !)
if gadget is clicked (or some item is selected in combobox), it's pointer must be returned !, no matter if this item value is already setted via SetComboBoxVal..

edit
Thx, for reply, I'll test it again.

edit2
Perfect !
Last edited by petan on Mar 20, 2016 12:16, edited 1 time in total.
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

description of the "original" behavior of the combobox:
before the miniselector is called we save the current entry in Ctrl(14).
when the (valid) result of the miniselector, saved in Ctrl(15), is different to Ctrl(14) then you get your GadgetMessage

Yes, and here's a small bug: if the value is zero, means no entry is selected, the cbox should appear empty.
the emptiness says to user, make a decision!

The SetComboBoxVal() contains a bug. Modify the limiter in this routine, u will find it in ComboBox.bas too

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

Re: sGUI

Post by petan »

Combobox+SetComboBoxVal fixed ;) thanks for description.
Note - IMO if cbox appears empty on no entry is selected, it's usefull feature, not a bug; this likes me.
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Another question - is Filerequester able to directly filter a files (with FindContents(), or other built-in function)
by (as new parameter) passed file suffix ? e.g. *.bas, or what I need now *.WDproj to find&load quickly designer project files ??
(I can do it with filtering results with Instr function, but using an existing sGUI function would be better)

edit -
yes, done.
Last edited by petan on Mar 21, 2016 17:43, edited 1 time in total.
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

i think the best way is to pimp the FindContents() routine with an additional Pattern-Parameter.
Mutton
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Ok, FileRequester2 tuning .. Done

Next thing, for designer I made widget to immediate changing default sGUI parameters, and there would be very handy to place
a new gadgettype (maybe named GridBox), slightly modified ComboBox with two resizable & editable columns (like Excell grid table),
to setting/changing directly sGUI variable and its value.
Did you think previously about such gadget type ? I have no idea howto write it..
Last edited by petan on Mar 21, 2016 17:13, edited 1 time in total.
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

nope, but i think its possible.... :)
every once in a while i screw on sGUI.
My main goal was to implant some thread stuff, as base for a window system... no, no, no... never getting friends :D
the rest is more a kind of cosmetics, no new controls. Meanwhile its possible to use a BMP Font. The new menu-system should support submenues, at moment unfinished, a lot stuff was rewritten/rearranged... i dont know, its unsatisfying, nothing for public.

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

Re: sGUI

Post by petan »

Good to know ;))
No free time for it by me now, designer testing takes a time especially for save/load-ing every gadget type plus clearing balast variables.
And also there is clear way to future setting every thinkable parameter for widget building, so I want to have its code written in good
condition for replacing constants with editable parameters in the next versions.
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

FileRequester2 tuned ;)
"FileRequester.bas"
FileRequester2 changes:

Code: Select all

'declare function FileRequester2(PosX as integer,PosY as integer,akcion as string,Path as string, File as string="",FExistMode as integer=0) as string	'old
declare function FileRequester2(PosX as integer,PosY as integer,akcion as string,Path as string, File as string="",FExistMode as integer=0,fileMask as string="") as string
'declare sub FindContent(gad as Gadget ptr,t as string )	'orig
declare sub FindContent(gad as Gadget ptr,t as string,fileMask as string="")	'my
(...)
function FileRequester2(PosX as integer,PosY as integer,akcion as string,Path as string, File as string="",FExistMode as integer=0,fileMask as string="") as string		
(...)
TO_ClearText(contlist)
  FindContent(contlist,"D")
  'FindContent(contlist,"F")	'orig
  if fileMask<>"" then 		'my
   FindContent(contlist,"F",fileMask)	'my
  else
   FindContent(contlist,"F")	'orig
  end if
  UpdateGadget(contlist)
(...)
    if event->GADGETMESSAGE then
      select case event->GADGETMESSAGE
'===========================================
        'Pfadeingabe
        case strpath
          chdir GetString(strpath)           'Wechsel ins Directory
          Path=curdir                        'Setze aktuellen Pfad
           if right(Path,1)<>sep then Path+=sep		'fix path slash if missing
           
          TO_ClearText(contlist)
          FindContent(contlist,"D")
'          FindContent(contlist,"F")		'orig
	  if fileMask<>"" then FindContent(contlist,"F",fileMask) else FindContent(contlist,"F")	'my
          UpdateGadget(contlist)

          SetString(strpath,Path)                     'Aktualisiere die Pfadanzeige
'===========================================
        case contlist
          entry=TO_GetLineContent(contlist,GetListBoxVal(contlist))

          if entry<>"" then
            if left(entry,6)="<DIR> " then                'wenn entry ein Directory
              GadgetSleep(aFileMask)
              GoToFolder=right(entry,len(entry)-6)
              chdir GoToFolder                   'Wechsel ins Directory
              Path=curdir                        'Setze aktuellen Pfad
			   if right(Path,1)<>sep then Path+=sep		'fix path slash if missing

              TO_ClearText(contlist)
              FindContent(contlist,"D")
'              FindContent(contlist,"F")		'orig
	      if fileMask<>"" then FindContent(contlist,"F",fileMask) else FindContent(contlist,"F")	'my
              UpdateGadget(contlist)
              SetString(strpath,Path)                     'Aktualisiere die Pfadanzeige
			else                     'non-directory
				GadgetOn(aFileMask)
            end if
              File=entry
              SetString(strfile,File)
          end if

'===========================================
        case cdparent
          chdir ".."                                  'Wechsel ins übergeordnete Directory
          Path=curdir                        'Setze aktuellen Pfad
           if right(Path,1)<>sep then Path+=sep		'fix path slash if missing
          
          TO_ClearText(contlist)
          FindContent(contlist,"D")
'          FindContent(contlist,"F")		'orig
          if fileMask<>"" then FindContent(contlist,"F",fileMask) else FindContent(contlist,"F")	'my
          UpdateGadget(contlist)
           SetString(strpath,Path)                     'Aktualisiere die Pfadanzeige        
'===========================================
				'Beenden und Rückabe eines Strings
        case doit
(...)

Code: Select all

'sub FindContent(gad as Gadget ptr,t as string )		'orig
sub FindContent(gad as Gadget ptr,t as string,fileMask as string="")	'my
  dim as integer attr
  dim as string entryname,pre
  if ucase(t)="D" then 'bei "D" suche nach Verzeichnissen
    attr=&H10 + &H01
    pre="<DIR> "       '"Vorsilbe" um Verzeichnisse von Dateien unterscheiden zu können
  end if		'orig
  if ucase(t)="F" then  'bei "F" suche nach Dateien
    attr=&H00
    pre=""
  end if

  entryname=dir("*",attr)		
  if fileMask<>"" then entryname=dir("*."+fileMask,attr)			'my

  do
    if (len(entryname)>0) and (entryname<>".") and (entryname<>"..") then TO_AppendLine(gad,pre & entryname)	'orig
    entryname=dir
  loop while len(entryname)
end sub
Usage - directly to find files with mask, e.g *.WDproj

Code: Select all

WDprojFile=FileRequester2(160,80,"Load",curdir,,1,"WDproj")
Note - FindContent() could be tuned more without header change, for now untouched.
S'shot - http://www.4shared.com/download/cDRSG0PRce/FR2a.png
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Hi, Mutton
It's time to expand words editing possibilities to standard way - now I need to frequently set/change text in string gadgets
(values of properties in designer) in quick way, t.m. to have enabled catching keypresses of Home, End, Backspace, Delete (text or all the line from left, or from right side), Ctrl-C and mouse strike thru for text highlightning.
Actual status has low comfort, IIRC deleting word only from one side..?
I can add something more control, if you don't have written new things for text editing control.But not sured, if here doesn't exist better way to do so via using some freebasic '.bi' file...
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Founded temporary solution to quick clear all text in string gadget of values, if there is printed only default helper text e.g. "(none)" or "( ??? )".Property variable is selected from combobox, its value is printed in string gadget.After click on string gadget and its value is equal to default -> clearing gadget contents.
But for editing of real value would be mouse hover selecting text an ideal way.
petan
Posts: 683
Joined: Feb 16, 2010 15:34
Location: Europe
Contact:

Re: sGUI

Post by petan »

Looking on internal text functions, there is already 'sub TextObject.KeyDelete' for catching, BUT deleting to right not working properly
on linux !
After tracking I got ASCCODE 83 for DELETE keypress on linux, so code modified.Problem founded/fixed in "StringGadget.bas"
Not sured how are FB internally solved scancodes on win/lin, but my logical thought goes to using literals, not numbers.
If somebody can explain this trouble.., thx.
changes in "StringGadget.bas"

Code: Select all

(...) 
function StringGadgetActions(gad as Gadget ptr,action as integer) as integer
(...)      
      case GADGET_KEYBOARD   'Keyboardauswertung

' ? "ASCCODE ";ASCCODE		 'my

        'ob eine Taste gedrückt wurde, ist schon in GadgetControl überprüft worden
        'wenn man bis hierher gelangt ist, wurde etwas gedrückt
        if EXTENDED then
          'Cursorbewegung mit Pfeiltasten
          if ASCCODE=75 then gad->TObject->CursorLeft
          if ASCCODE=77 then gad->TObject->CursorRight
          'added by MilkFreeze, modified by Muttonhead :D
          if ASCCODE=71 then gad->TObject->CursorKeyPos1
          if ASCCODE=79 then gad->TObject->CursorKeyEnd
          TraceCursorPosition(gad->gad(0))
          DrawGadget(gad->gad(0))
          
          'DEL Windows		'orig
'          #ifdef __fb_win32__	'orig	
            'if ASCCODE=83 then 'orig
      'DELETE win lin  i hope			 'my
            if ASCCODE=FB.SC_DELETE then         'my
              gad->TObject->KeyDelete
              TraceCursorPosition(gad->gad(0))
              DrawGadget(gad->gad(0))
            end if
'          #endif		'orig

        else
(...)
Delete chars in string (StringGadget) to right and to left now working as needed ;)
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: sGUI

Post by Muttonhead »

Is there a chance to port all of your modifications to a new version of sGUI? At moment its a preview only...
*now it should work with 64bit
*new mem management
*new menu system
*a lot of internal modifications, no new gadgets...
http://www.muttonhead.homepage.t-online ... _alpha.zip

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

Re: sGUI

Post by petan »

Nice !
I hope that yes, I must take a look on it ;)
and it 'll goes slowly in the next 2 weeks, I am on 4 court cases.. (3 tomorrow)
But don't worry, I'll report.Shortly I have it all too much nowadays.
Post Reply