TSBrowse :UserKeys strange things

75 views
Skip to first unread message

Gilbert Vaillancourt

unread,
May 25, 2026, 9:28:58 AM (13 days ago) May 25
to Harbour Minigui
Hi All,

I'm trying to enhance the IniEditor function of IniTest to incorporate easy capture routine for Arrays, Matrix & Hash array. To do this I'm using TSBrowse, but I'm getting strange reaction from it.

1. If I declare :UserKeys( VK_INSERT ... ) => As soon as the browse appears a blank record is added to the end of the browse.

2. I also declare :UserKeys( VK_DELETE ... ) => But it has no effect and does not delete the current record.

Here is a smal working sample for you to investigate.

#include "minigui.ch"
#include "TSBrowse.ch"

//-----------------------------------------------------------------------------

procedure Main ()
local lSave  := .F.
local cEntry := "Titles"
local aValue := {{"1", "Madame Blue"},        ;
                 {"2", "Crystal Ball"},       ;
                 {"3", "Mr. Roboto"},         ;
                 {"4", "Sweet Mademoiselle"}, ;
                 {"5", "Paradise Theatre"}}

define window oDlgAddEntry         ;
       at 0, 0                     ;
       width 500 height 530        ;
       title  "Add Entry and Value to Section : " ;
       font "MS Sans Serif" size 9 ;
       main

   @  10,  10 label oTxtType width 250 height 20 value "Array Expression" bold
   @  35,  10 label oLblEntry width 80 height 20 value "Entry :" rightalign
   @  35,  95 getbox oGetEntry width 250 height 20 value cEntry readonly

   define tbrowse oBrwValue at 60, 5 of oDlgAddEntry ;
          width 490 height 350                       ;
          grid

      oBrwValue:SetArray(aValue)
      oBrwValue:nHeightCell += 4
      oBrwValue:nHeightHead += 4
      oBrwValue:nWheelLines := 1
      oBrwValue:lNoHScroll  := .T.
      oBrwValue:nCell       := 2
      oBrwValue:nFreeze     := 1
      oBrwValue:lLockFreeze := .T.

      oBrwValue:UserKeys(VK_INSERT, {|oBrwValue| oBrwValue:AddItem({AllTrim(Str(oBrwValue:nLen +1)), Space(50)}), ;
                                                 oBrwValue:GoPos(oBrwValue:nLen, 2), oBrwValue:Refresh()})
      oBrwValue:UserKeys(VK_DELETE, {|oBrwValue| oBrwValue:DeleteRow(), oBrwValue:Refresh()})

      add column to oBrwValue data array element 1 ;
          header "Items" width 40                  ;
          align DT_RIGHT

      add column to oBrwValue data array element 2 ;
          header "Values" width 440                ;
          align DT_LEFT                            ;
          editable

   end tbrowse

   @ 425,  10 label oLblInsert width 100 height 20 value "<Ins> = New value"
   @ 445,  10 label oLblEdit width 100 height 20   value "<Ent> = Edit value"
   @ 465,  10 label oLblDelete width 100 height 20 value "<Del> = Delete value"

   @ 430, 155 buttonex oBtnCancel   ;
              width 120 height 40   ;
              caption "Cancel"      ;
              font "TAHOMA" size 10 ;
              picture "CANCEL_24"   ;
              notabstop             ;
              action {|| lSave := .F., oDlgAddEntry.Release()}

   @ 430, 300 buttonex oBtnAccept   ;
              width 120 height 40   ;
              caption "Save"        ;
              font "TAHOMA" size 10 ;
              picture "ACCEPT_24"   ;
              notabstop             ;
              action {|| lSave := .T., oDlgAddEntry.Release()}

end window

oBrwValue:SetFocus()

oDlgAddEntry.Center()
oDlgAddEntry.Activate()

Return (NIL)

Regards
Gilbert Vaillancourt

Krzysztof Stankiewicz

unread,
May 29, 2026, 5:58:57 PM (9 days ago) May 29
to Harbour Minigui
Left mouse button and (by the way) ENTER key

 oBrwValue  :bLDblClick := {|nrp,ncp,nat,obr|  {|oBrwValue| oBrwValue:AddItem({AllTrim(Str(oBrwValue:nLen +1)), Space(50)}), ;

                                                 oBrwValue:GoPos(oBrwValue:nLen, 2), oBrwValue:Refresh()}   }

Reply all
Reply to author
Forward
0 new messages