Page 1 of 2

How to make TFolderEx excel-like?

PostPosted: Wed Nov 09, 2022 7:54 am
by hua
I was tasked to do the following:

i. Allow user to change tab names on the go similar to excel sheet. Right click, key-in new tab name and see it immediately reflected

ii. Have something similar to excel new sheet icon where on clicking it, a new folder would be added

Any pointers? TIA

Re: How to make TFolderEx excel-like?

PostPosted: Wed Nov 09, 2022 8:40 am
by Jimmy
hi hua,
hua wrote:i. Allow user to change tab names on the go similar to excel sheet. Right click, key-in new tab name and see it immediately reflected

Code: Select all  Expand view
METHOD RButtonDown( nRow, nCol, nFlags ) CLASS TFolderEx
...
      if ::bRClicked != nil
         Eval( ::bRClicked, nRow, nCol, nFlags, Self )

so what is your Problem :?:

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 2:23 am
by hua
Getting the new name is the easy part. But what method to call to change the Tab's name?

Image

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 4:42 am
by cnavarro
Try with
Code: Select all  Expand view

   // n := oFld:nOption
   oFld:aPrompts[ n ] := "New Name"
   //oFld:Default()
   oFld:Refresh()
 

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 6:24 am
by Jimmy
hi,

i have this to change "Name of TAB"
Code: Select all  Expand view
  aPrompts := ACLONE( oTab:aPrompts )
   aPrompts[ nDim ] := aToken[ LEN( aToken ) - 1 ]  // Name of Folder
   oTab:SetPrompts( aPrompts )

Image

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 7:01 am
by hua
Thanks Cristobal, it works.
However is it possible to adjust the tab width automatically to accommodate long name?
Thank you

cnavarro wrote:Try with
Code: Select all  Expand view

   // n := oFld:nOption
   oFld:aPrompts[ n ] := "New Name"
   //oFld:Default()
   oFld:Refresh()
 

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 7:02 am
by hua
Thank Jimmy.
:setPrompts() is only available if using TFolder class. I am using TFolderEx

Jimmy wrote:i have this to change "Name of TAB"
Code: Select all  Expand view
  aPrompts := ACLONE( oTab:aPrompts )
   aPrompts[ nDim ] := aToken[ LEN( aToken ) - 1 ]  // Name of Folder
   oTab:SetPrompts( aPrompts )


Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 7:16 am
by Antonio Linares
Dear Hua,

Please check DATA aSizes

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 7:46 am
by hua
Thanks for the tip Antonio.

How to be able to right-click on a TTitle and change the text Antonio? Would it be possible?

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 8:49 am
by Antonio Linares
Try this:

oTitle:aText[ 3 ] = "new text"
oTitle:Refresh()

Re: How to make TFolderEx excel-like?

PostPosted: Thu Nov 10, 2022 11:55 am
by cnavarro
hua wrote:Thanks Cristobal, it works.
However is it possible to adjust the tab width automatically to accommodate long name?
Thank you

cnavarro wrote:Try with
Code: Select all  Expand view

   // n := oFld:nOption
   oFld:aPrompts[ n ] := "New Name"
   //oFld:Default()
   oFld:Refresh()
 


Please, for this, call method oFld:Default(), and try

Re: How to make TFolderEx excel-like?

PostPosted: Mon Nov 14, 2022 10:38 am
by hua
Thanks Cristobal. I'll give it a try.

cnavarro wrote:
hua wrote:Thanks Cristobal, it works.
However is it possible to adjust the tab width automatically to accommodate long name?
Thank you

cnavarro wrote:Try with
Code: Select all  Expand view

   // n := oFld:nOption
   oFld:aPrompts[ n ] := "New Name"
   //oFld:Default()
   oFld:Refresh()
 


Please, for this, call method oFld:Default(), and try

Re: How to make TFolderEx excel-like?

PostPosted: Mon Nov 14, 2022 10:39 am
by hua
Thanks Antonio. This works!
Anything similar for images created using TITLEIMG?

Antonio Linares wrote:Try this:

oTitle:aText[ 3 ] = "new text"
oTitle:Refresh()

Re: How to make TFolderEx excel-like?

PostPosted: Mon Nov 14, 2022 11:24 am
by Antonio Linares
Dear Hua,

Do you mean to replace the image ?

Re: How to make TFolderEx excel-like?

PostPosted: Tue Nov 15, 2022 2:17 am
by hua
Yes. To allow user to choose other image to replace the current one being displayed.
Thanks.

Antonio Linares wrote:Do you mean to replace the image ?