PDA

View Full Version : Usage of the IIF$ Keyword



Michael Clease
28-05-2007, 01:03
Not that happy with this but i havent done any console work and it shows the command better with some user input, well thats what I think.



' Usage of the IIF$ Keyword example
'
' Changes the button text depending on which one is clicked
'
' Written by Psch modified by Abraxas

uses "UI"

DIM hDlg AS DWORD
dim Msg, wparam,lparam as dword
DIM buttext as string value "Red Pill"

DIALOG NEW 0, "IIF$ Example",-1,-1, 300, 100, %WS_POPUP OR %WS_VISIBLE OR %WS_CLIPCHILDREN OR %WS_CAPTION OR %WS_SYSMENU OR %WS_MINIMIZEBOX, 0 TO hDlg

CONTROL ADD button, hDlg, 1001, Buttext, 50, 50, 90, 20
CONTROL ADD button, hDlg, 1002,"Blue Pill", 150, 50, 90, 20

DIALOG SHOW modeless hDlg

while isWindow(hDlg)
Msg = GetMessage(hDlg, wParam, lParam)

select case Msg

case %WM_Command

' IIF$ checks which buttons clicked and changes the text of a button
buttext = iif$ (wParam = 1001, "Try the blue pill", "Red Pill")
CONTROL SET TEXt hDlg, 1001, buttext

if (wParam = 1002) then EXIT WHILE

CASE %WM_SYSCOMMAND
if wParam = %SC_CLOSE then EXIT WHILE

END SELECT

wend

DIALOG END hDlg

ErosOlmi
28-05-2007, 07:39
Added. Thanks