Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LISTBOX: can it contain a code to underline a letter?
#1
Morning,

I have designed a ListBox that has content like:

(A) Item one
(B) Item two
© Item three

in that pressing the letter in parenthesis acts as a hotkey and executes the line's command (see attachement)

MY QUESTION: can you embed a letter code for any letter, so that it is underlined in the ListBox? -and thus have the appearance of the 'alt key' in a normal menu?

Thanks,

Kent


Attached Files Image(s)
   
#2
Copy the _ from
http://www.fileformat.info/info/unicode ... ertest.htm
And paste in QM before the character.

With default dialog font may not look good. Try other fonts.
Function Dialog193
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 ListBox 0x54230101 0x200 8 8 96 48 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040308 "*" "" "" ""

str controls = "3"
str lb3
lb3="(̲S) ssssss[](̲D) dddddddd"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,__Font-- f.Create("Courier new")
,f.SetDialogFont(hDlg "3")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
Thanks and shall see how this goes?
#4
Which one should I use from your linked page? the "UTF-8"?
#5
This is the line of wherein the (S) is found:

case 2 mes "line-2 / (S)"

When you say, 'paste in front of' do you mean as:

case 2 mes "line-2 / (̲S)"

If so, I don't see any change?

Suggestions? Will the font need to be changed for this to at least be visible?
#6
Copy the _ character from the editable input field, and in QM script paste before a character to make that character underlined.

In Options must be checked Unicode.

Run function Dialog193 to see how it looks. With default font looks not so good.
#7
If I embed this into a listbox such as:

sel(ListDialog_24k(F"{LBXitem1ShowName} ..., etc., etc.
case 1 mes "line-1 / white-space"
case 2 mes "line-2 / (̲S)"
...

(ListDialog_24K is my edited version of this)

Where do I change the font?

Here is what I have done:

I've embedded that character in front of the 'S' of (S) as seen above
I checked the 'Unicode' options
Then I ran the macro, but I cannot see the _

YES, I did run your sample in 'Dialog 193' and it works there.
#8
Sorry for any wasted time. I was actually placing the Unicode font in front of the 'S' in the wrong place or wrong fucntion

This does present another question. I have a simple function in this set called 'TranslateAndPublish'

This is where I set what is revealed in the ListBox.

Here is the content of this function

***********************************
FUNCTION BEGINS

wait 0.15
LBXitem1ShowName=" "
LBXitem2ShowName="(̲S) item#1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx _word"
LBXitem3ShowName="(D) item#2"
LBXitem4ShowName="(W) item#3"
LBXitem5ShowName="(E) item#4"
LBXitem6ShowName="(X) item#5"
LBXitem7ShowName="© item#6"
LBXitem8ShowName="(J) item#7"
LBXitem9ShowName="(K) item#8"
LBXitem10ShowName=" "
LBXitem11ShowName="__________________________________"
LBXitem12ShowName="No More Options" ;;default setting
LBXitem13ShowName="__________________________________"
LBXitem14ShowName=" "
LBXitem15ShowName="__________________________________"
LBXitem16ShowName="<--(Q) Esc or 'Quit'"
LBXitem17ShowName="__________________________________"
LBXitem18ShowName=""
LBXitem19ShowName=""
LBXitem20ShowName=""
LBXitem21ShowName=""
.
wait 0.01
.
.CALL NEXT FUNC
Oc_ID_510271_all_VerifyRequest_MSG
mes "test" ;;for testing only

wait 0.01

FUNCTION ENDS
******************************

Can I set a font for the text in this function, such as

__Font-- f.Create("Tahoma" 10)
f.SetDialogFont ("")

And would this change the font that is used in the function?
#9
You can change dialog control font when you have dialog window handle.
In dialog procedure it is hDlg, and usually the best place is under case WM_INITDIALOG.
If you cannot edit dialog procedure, you can get dialog handle with win().

Function Function311
Code:
Copy      Help
int w=win("QM - Select" "#32770")
__Font+ g_fontCourierNew; if(!g_fontCourierNew) g_fontCourierNew.Create("Courier New" 10)
g_fontCourierNew.SetDialogFont(w "4")
#10
Morning Gintaras!

If you have a little more time & patience I would appreciate more help? THANKS! ( I'm sure that you know this, BUT WHEN you provide the 'baby-steps' that I need in this situation, IT HELPS ALL Quick Macro users who are not programmers!!!!)

In the example below, where would I place your last instructions in order to change the font?

Lets say that I have:

a macro (below) that calls for

a function that assigns variables (the variables populate the listbox)

and then a function for the list box


MACRO "TESTdialogFont" begins *********************************************

wait 0.01

TESTdialogFont1 ;; call for function


MACRO ENDS *******************************************************************


FUNCTION "TESTdialogFont1" begins ***************************************

str+ LBXitem1ShowName="(̲S) item#1"
str+ LBXitem2ShowName="(̲D) item#2"
str+ LBXitem3ShowName="(̲F) item#3"

wait 0.1

TESTdialogFont2 ;; call for listbox function

FUNCTION ENDS ****************************************************************


FUNCTION "TESTdialogFont3" begins ****************************************

wait 0.5

sel(ListDialog(F"{LBXitem1ShowName}[]{LBXitem2ShowName}[]{LBXitem3ShowName}" "ListBoxTitle"))
case 1 mes "item-1 selected"
case 2 mes "item-2 selected"
case 3 mes "item-3 selected"
case else ret

wait 0.01

FUNCTION ENDS ****************************************************************
#11
Macro Macro2723
Code:
Copy      Help
mac "sub.ChangeFont"
ListDialog("(̲S) ssssss[](̲D) dddddddd" "" "ListDialog85234")


#sub ChangeFont
int w=wait(30 WV win("ListDialog85234" "#32770" "qm")); err ret
__Font+ g_fontCourierNew; if(!g_fontCourierNew) g_fontCourierNew.Create("Courier New" 10)
g_fontCourierNew.SetDialogFont(w "4")
#12
Ok, and where does this go SPECIFICALLY in my example of the macro with two functions?
#13
mac "sub.ChangeFont" - before your ListDialog line.
#sub ... - at the bottom of the macro that calls ListDialog .
#14
THANKS!!!!! -shall proceed!


Forum Jump:


Users browsing this thread: 1 Guest(s)