Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can a menu/toolbar item's text-title be a string variable?
#1
Hi All,

Couldn't seem to find this in the help files.
Thanks,
Stuart
#2
Normally not, but you can use function DynamicMenu or DynamicToolbar to create menu/tb at run time, with variables. Using templates simplifies this.

Example
Menu Menu17
Code:
Copy      Help
Macro1 :mac "%s"
Macro2 :mac "%s"

Macro
Code:
Copy      Help
str m1="Macro1"
str m2="Macro2"
str s.format(_s.getmacro("Menu17") m1 m2)
DynamicMenu s "temp_Menu17"

Menu17 is used as template. %s are replaced with variables.
#3
As usual.
Thanks a million,
Stuart
#4
Trying to do something like this...

Toolbar

stringvariable :mac "whatever"

Is that possible. It would be a dynamically changing thing set in the interval from the last time the the toolbar macro was run.

Is that possible?

Stuart
#5
Like this?

Code:
Copy      Help
str s=
;%s :out 1
;%s :out 2


int i
for i 0 10
,str m.format("Macro%i" i)
,str ss.format(s m "x")
,DynamicToolbar ss "temp_tb55"
,0.5
#6
That's really cool though.
All I am trying to do is have the "notename" text of the ShowNote function be a string variable

Code:
Copy      Help
str s="some text"
ShowNote "notename" s win("Quick Macros" "QM_Editor")

when I put my string name in for "notename", it works but it creates a brand new toolbar in the user section with default settings for toolbar (location, shrinksize, etc) and creates an everexpanding list of notes.

Two questions,
is there a way within a maacro to delete the notes

and

is there a way to set the parameters ahead of time for the note generated by ShowNote

Thanks again,
Stuart
#7
To change button text can be used this function.

Function ChangeQmToolbarButtonText
Code:
Copy      Help
;/
function $tbname button $text

;Changes QM toolbar button text.
;Returns 1 if successful, 0 if not.
;Note: The original text is restored when you change toolbar style through the right-click menu.


;tbname - toolbar name.
;button - 0-based line index in toolbar text.
;text - new text.



str sn=tbname
int h=win(sn.ucase "QM_toolbar"); if(!h) ret
h=id(9999 h)
TBBUTTONINFO ti.cbSize=sizeof(ti)
ti.dwMask=TBIF_TEXT
ti.pszText=text
ret SendMessage(h TB_SETBUTTONINFO button &ti)

You can create your own ShowNote2 function that calls ShowNote and ChangeQmToolbarButtonText.

Quote:is there a way within a maacro to delete the notes

Try newitem with flag 32.


Quote:is there a way to set the parameters ahead of time for the note generated by ShowNote

int ShowNote([~name] [~text] [hwndowner] [$template] [flags])
#8
absolutely phenomenal!
Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)