summaryrefslogtreecommitdiff
path: root/plugins/Actman/i_visual.inc
blob: ab32488165c2e450d8762d29222a7dd08dc31d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
{Dialog visual part, depends of Dialog window}
  procedure SHControl(ctrl,mode:dword);
  begin
    ShowWindow(GetDlgItem(Dialog,ctrl),mode);
  end;

  procedure SetupControls(group,mode:dword);
  begin
    case group of
      ACT_CONTACT: begin
        SHControl(IDC_STAT_CONTACT,mode);
        SHControl(IDC_CONTACTLIST ,mode);
        SHControl(IDC_CNT_KEEP    ,mode);
        SHControl(IDC_CNT_FILTER  ,mode);
        SHControl(IDC_STAT_FORMAT ,mode);
        SHControl(IDC_EDIT_FORMAT ,mode);
        SHControl(IDC_CNT_APPLY   ,mode);
        SHControl(IDC_STAT_FHELP  ,mode);
      end;
      ACT_SERVICE: begin
        SHControl(IDC_STAT_WPAR   ,mode);
        SHControl(IDC_STAT_LPAR   ,mode);
        SHControl(IDC_STAT_WPAR1  ,mode);
        SHControl(IDC_STAT_LPAR1  ,mode);
        SHControl(IDC_STAT_SERVICE,mode);
        SHControl(IDC_EDIT_SERVICE,mode);
        SHControl(IDC_SRV_SRVC    ,mode);
        SHControl(IDC_FLAG_WPAR   ,mode);
        SHControl(IDC_FLAG_LPAR   ,mode);

        SHControl(IDC_RES_GROUP   ,mode);
        SHControl(IDC_RES_POPUP   ,mode);
        SHControl(IDC_RES_MESSAGE ,mode);
        SHControl(IDC_RES_INSERT  ,mode);

        SHControl(IDC_SRV_RESULT  ,mode);
        SHControl(IDC_SRV_RESSTAT ,mode);

        if mode=SW_SHOW then
        begin
//!! Check parameter type
          if CB_GetData(GetDlgItem(Dialog,IDC_FLAG_WPAR))=ptStruct then
//          if SendDlgItemMessage(Dialog,IDC_FLAG_WPAR,CB_GETCURSEL,0,0)=ptStruct then
          begin
            SHControl(IDC_WSTRUCT  ,SW_SHOW);
            SHControl(IDC_EDIT_WPAR,SW_HIDE);
            SHControl(IDC_SRV_WPAR ,SW_HIDE);
          end
          else
          begin
            SHControl(IDC_WSTRUCT  ,SW_HIDE);
            SHControl(IDC_EDIT_WPAR,SW_SHOW);
            SHControl(IDC_SRV_WPAR ,SW_SHOW);
          end;
          if CB_GetData(GetDlgItem(Dialog,IDC_FLAG_LPAR))=ptStruct then
//          if SendDlgItemMessage(Dialog,IDC_FLAG_LPAR,CB_GETCURSEL,0,0)=ptStruct then
          begin
            SHControl(IDC_LSTRUCT  ,SW_SHOW);
            SHControl(IDC_EDIT_LPAR,SW_HIDE);
            SHControl(IDC_SRV_LPAR ,SW_HIDE);
          end
          else
          begin
            SHControl(IDC_LSTRUCT  ,SW_HIDE);
            SHControl(IDC_EDIT_LPAR,SW_SHOW);
            SHControl(IDC_SRV_LPAR ,SW_SHOW);
          end;

          case CB_GetData(GetDlgItem(Dialog,IDC_SRV_RESULT)) of
            sresHex: ;
            sresInt: SHControl(IDC_RES_SIGNED,SW_SHOW);
            sresString: begin
              SHControl(IDC_RES_UNICODE,SW_SHOW);
              SHControl(IDC_RES_FREEMEM,SW_SHOW);
            end;
            sresStruct: ;
          end;

        end
        else
        begin
          SHControl(IDC_WSTRUCT    ,SW_HIDE);
          SHControl(IDC_LSTRUCT    ,SW_HIDE);
          SHControl(IDC_SRV_WPAR   ,SW_HIDE);
          SHControl(IDC_SRV_LPAR   ,SW_HIDE);
          SHControl(IDC_EDIT_WPAR  ,SW_HIDE);
          SHControl(IDC_EDIT_LPAR  ,SW_HIDE);
          SHControl(IDC_RES_FREEMEM,SW_HIDE);
          SHControl(IDC_RES_UNICODE,SW_HIDE);
          SHControl(IDC_RES_SIGNED ,SW_HIDE);
        end;
      end;
      ACT_PROGRAM: begin
        SHControl(IDC_PROCESS_GROUP,mode);
        SHControl(IDC_PROGRAM      ,mode);
        SHControl(IDC_EDIT_PROCTIME,mode);
        SHControl(IDC_EDIT_PRGPATH ,mode);
        SHControl(IDC_PRG_PRG      ,mode);
        SHControl(IDC_EDIT_PRGARGS ,mode);
        SHControl(IDC_PRG_ARG      ,mode);
        SHControl(IDC_STAT_PROCTIME,mode);
        SHControl(IDC_STAT_PRGPATH ,mode);
        SHControl(IDC_STAT_PRGARGS ,mode);

        SHControl(IDC_PRSTART_GROUP,mode);
        SHControl(IDC_FLAG_NORMAL  ,mode);
        SHControl(IDC_FLAG_HIDDEN  ,mode);
        SHControl(IDC_FLAG_MAXIMIZE,mode);
        SHControl(IDC_FLAG_MINIMIZE,mode);

        SHControl(IDC_FLAG_CURPATH,mode);
        SHControl(IDC_FLAG_CONTINUE,mode);
        SHControl(IDC_FLAG_PARALLEL,mode);

        if mode=SW_SHOW then
        begin
          if isVarsInstalled then
             SHControl(IDC_HLP_FVARS,SW_SHOW);
        end
        else
          SHControl(IDC_HLP_FVARS,SW_HIDE);
      end;
      ACT_TEXT: begin
        SHControl(IDC_FLAG_CLIP   ,mode);
        SHControl(IDC_FLAG_MESSAGE,mode);
        SHControl(IDC_CLIP_COPYTO ,mode);
        SHControl(IDC_CLIP_PASTE  ,mode);
        SHControl(IDC_CLIP_GROUP  ,mode);
        SHControl(IDC_FILE_ENC    ,mode);

        SHControl(IDC_FLAG_FILE   ,mode);
        SHControl(IDC_FILE_PATH   ,mode);
        SHControl(IDC_TXT_FILE    ,mode);
        SHControl(IDC_FILE_FILEBTN,mode);
        SHControl(IDC_FILE_READ   ,mode);
        SHControl(IDC_FILE_WRITE  ,mode);
        SHControl(IDC_FILE_APPEND ,mode);
        SHControl(IDC_FILE_GROUP  ,mode);

        SHControl(IDC_TXT_TEXT     ,mode);
        SHControl(IDC_EDIT_INSERT  ,mode);
        SHControl(IDC_STAT_INSERT  ,mode);

        if mode=SW_SHOW then
        begin
          if isVarsInstalled then
             SHControl(IDC_HLP_VARS,SW_SHOW);
        end
        else
          SHControl(IDC_HLP_VARS,SW_HIDE);
      end;
      ACT_ADVANCE: begin
        SHControl(IDC_CONDITION,mode);
        SHControl(IDC_FLAG_GT  ,mode);
        SHControl(IDC_FLAG_LT  ,mode);
        SHControl(IDC_FLAG_EQ  ,mode);
        SHControl(IDC_FLAG_NOP ,mode);
        SHControl(IDC_FLAG_NOT ,mode);
        SHControl(IDC_ADV_VALUE,mode);
        SHControl(IDC_STAT_VAL ,mode);
        SHControl(IDC_ADV_ASINT,mode);

        SHControl(IDC_OPERATION ,mode);
        SHControl(IDC_FLAG_BREAK,mode);
        SHControl(IDC_FLAG_JUMP ,mode);
        SHControl(IDC_FLAG_ANOP ,mode);

        SHControl(IDC_FLAG_MATH,mode);
        SHControl(IDC_ADV_OPER ,mode);
        SHControl(IDC_ADV_VAL2 ,mode);
        SHControl(IDC_ADV_VAL1 ,mode);

        if mode=SW_SHOW then
        begin
          if isVarsInstalled then
             SHControl(IDC_ADV_HVARS,SW_SHOW);
        end
        else
          SHControl(IDC_ADV_HVARS,SW_HIDE);
        SHControl(IDC_FLAG_VARS,mode);
        SHControl(IDC_ADV_VARS ,mode);
      end;
      ACT_CHAIN: begin
        SHControl(IDC_STAT_GROUPS,mode);
        SHControl(IDC_GROUP_LIST ,mode);
      end;
      ACT_RW: begin
        SHControl(IDC_STAT_CONTACT,mode);
        SHControl(IDC_CONTACTLIST ,mode);

        SHControl(IDC_RW_OPER   ,mode);
        SHControl(IDC_RW_VAL    ,mode);
        SHControl(IDC_RW_READ   ,mode);
        SHControl(IDC_RW_WRITE  ,mode);
        SHControl(IDC_RW_DELETE ,mode);
        SHControl(IDC_RW_STATM  ,mode);
        SHControl(IDC_RW_MODULE ,mode);
        SHControl(IDC_RW_STATS  ,mode);
        SHControl(IDC_RW_SETTING,mode);
        SHControl(IDC_RW_TVAR   ,mode);

        if mode=SW_SHOW then
        begin
          if CB_GetData(GetDlgItem(Dialog,IDC_RW_DATATYPE))>2 then
          begin
            SHControl(IDC_RW_VALUE,SW_HIDE);
            SHControl(IDC_RW_TEXT ,SW_SHOW);
          end
          else
          begin
            SHControl(IDC_RW_VALUE,SW_SHOW);
            SHControl(IDC_RW_TEXT ,SW_HIDE);
          end
        end
        else
        begin
          SHControl(IDC_RW_VALUE,SW_HIDE);
          SHControl(IDC_RW_TEXT ,SW_HIDE);
        end;
        SHControl(IDC_RW_DATATYPE,mode);

        SHControl(IDC_RW_CURRENT,mode);
        SHControl(IDC_RW_PARAM  ,mode);
        SHControl(IDC_RW_RESULT ,mode);
        SHControl(IDC_RW_MANUAL ,mode);
        SHControl(IDC_RW_LAST   ,mode);

        SHControl(IDC_RW_MVAR   ,mode);
        SHControl(IDC_RW_SVAR   ,mode);
      end;
      ACT_MESSAGE: begin
        SHControl(IDC_MSG_KEEP  ,mode);
        SHControl(IDC_MSG_STAT1 ,mode);
        SHControl(IDC_MSG_STAT2 ,mode);
        SHControl(IDC_MSG_TITLE ,mode);
        SHControl(IDC_MSG_TEXT  ,mode);
        SHControl(IDC_MSG_BTNS  ,mode);
        SHControl(IDC_MSGB_ARI  ,mode);
        SHControl(IDC_MSGB_OK   ,mode);
        SHControl(IDC_MSGB_OC   ,mode);
        SHControl(IDC_MSGB_RC   ,mode);
        SHControl(IDC_MSGB_YN   ,mode);
        SHControl(IDC_MSGB_YNC  ,mode);
        SHControl(IDC_MSG_ICONS ,mode);
        SHControl(IDC_MSGI_NONE ,mode);
        SHControl(IDC_MSGI_WARN ,mode);
        SHControl(IDC_MSGI_INFO ,mode);
        SHControl(IDC_MSGI_QUEST,mode);
        SHControl(IDC_MSGI_ERROR,mode);

        SHControl(IDC_MSG_TTL   ,mode);
        SHControl(IDC_MSG_TXT   ,mode);
      end;
    end;
  end;

  procedure SetButtonOnOff(ctrl,state:dword);
  begin
    CheckDlgButton(Dialog,ctrl,state);
    case ctrl of
      IDC_SRV_WPAR,
      IDC_SRV_LPAR,
      IDC_SRV_SRVC,
      IDC_PRG_PRG ,
      IDC_PRG_ARG ,
      IDC_TXT_FILE,
      IDC_TXT_TEXT,
      IDC_RW_MVAR ,
      IDC_RW_SVAR ,
      IDC_RW_TVAR ,
      IDC_MSG_TTL ,
      IDC_MSG_TXT : SetButtonIcon(GetDlgItem(Dialog,ctrl),checknames[state]);
     end;
  end;

  procedure ButtonOff(ctrl:dword); {$IFDEF MSWINDOWS}inline;{$ENDIF}
  begin
    SetButtonOnOff(ctrl,BST_UNCHECKED);
  end;

  procedure ButtonOn(ctrl:dword); {$IFDEF MSWINDOWS}inline;{$ENDIF}
  begin
    SetButtonOnOff(ctrl,BST_CHECKED);
  end;

  procedure TextClear(ctrl:dword);
  begin
    SetDlgItemTextW(Dialog,ctrl,nil);
  end;

  function FixParam(buf:PAnsiChar;flag:integer):integer;
  begin
    if      lstrcmpia(buf,Translate('hContact' ))=0 then result:=ptCurrent
    else if lstrcmpia(buf,Translate('parameter'))=0 then result:=ptParam
    else if lstrcmpia(buf,Translate('result'   ))=0 then result:=ptResult
    else if lstrcmpia(buf,Translate('structure'))=0 then result:=ptStruct
    else
    begin
      if (buf[0] in ['0'..'9']) or ((buf[0]='-') and (buf[1] in ['0'..'9'])) or
        ((buf[0]='$') and (buf[1] in sHexNum)) then
        result:=ptNumber
      else
        result:=ptString;
    end;

    CB_SelectData(Dialog,flag,result);
//    SendDlgItemMessage(Dialog,flag,CB_SETCURSEL,result,0);
    SendMessage(Dialog,WM_COMMAND,(CBN_SELCHANGE shl 16) or flag,GetDlgItem(Dialog,flag));
  end;

  procedure ReloadService;
  var
    pc:pAnsiChar;
    buf,buf1:array [0..MaxDescrLen] of AnsiChar;
    wnd:hwnd;
    i:integer;
//    bufw:array [0..MaxDescrLen] of WideChar;
  begin
    wnd:=GetDlgItem(Dialog,IDC_EDIT_SERVICE);
    SendMessageA(wnd,CB_GETLBTEXT,SendMessage(wnd,CB_GETCURSEL,0,0),tlparam(@buf));
    ApiCard.Service:=@buf;

    pc:=ApiCard.FillParams(GetDlgItem(Dialog,IDC_EDIT_WPAR),true);
    if pc<>nil then
    begin
      if GetDlgItemTextA(Dialog,IDC_EDIT_WPAR,buf1,SizeOf(buf1))>0 then
        case FixParam(@buf1,IDC_FLAG_WPAR) of
          ptStruct: begin
            mFreeMem(wstruct);
            StrDup(wstruct,StrScan(pc,'|')+1);
//            AnsiToWide(StrScan(pc,'|')+1,wstruct,MirandaCP);
          end;
        end;
      mFreeMem(pc);
    end;

    pc:=ApiCard.FillParams(GetDlgItem(Dialog,IDC_EDIT_LPAR),false);
    if pc<>nil then
    begin
      if GetDlgItemTextA(Dialog,IDC_EDIT_LPAR,buf1,SizeOf(buf1))>0 then
        case FixParam(@buf1,IDC_FLAG_LPAR) of
          ptStruct: begin
            mFreeMem(lstruct);
            StrDup(lstruct,StrScan(pc,'|')+1);
//            AnsiToWide(StrScan(pc,'|')+1,lstruct,MirandaCP);
          end;
        end;
      mFreeMem(pc);
    end;

    pc:=ApiCard.ResultType;
    i:=sresInt;
    if pc<>nil then
    begin
      if      lstrcmpia(pc,'struct')=0 then i:=sresStruct
      else if lstrcmpia(pc,'hex'   )=0 then i:=sresHex
      else if lstrcmpia(pc,'int')=0 then
      begin
        i:=sresInt;
        ButtonOff(IDC_RES_SIGNED);
      end
      else if lstrcmpia(pc,'signed')=0 then
      begin
        i:=sresInt;
        ButtonOn(IDC_RES_SIGNED);
      end
      else if lstrcmpia(pc,'str')=0 then
      begin
        i:=sresString;
        ButtonOff(IDC_RES_UNICODE);
      end
      else if lstrcmpia(pc,'wide')=0 then
      begin
        i:=sresString;
        ButtonOn(IDC_RES_UNICODE);
      end;
      mFreeMem(pc);
    end;
    CB_SelectData(Dialog,IDC_SRV_RESULT,i);

//    ApiCard.Show;
  end;

  procedure SelectActionType(group:dword);
  var
    i:integer;
  begin
    for i:=0 to ACT_MAXTYPE-1 do
      if ActIds[i].code=group then break;
    SendDlgItemMessage(Dialog,IDC_ACTION_TYPE,CB_SETCURSEL,i,0);
  end;

  procedure ClearControls(group:dword);
  begin
//!    SelectActionType(group);
    case group of
      ACT_CONTACT: begin
        EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),true);
        SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_SETCURSEL,0,0);
        ButtonOff(IDC_CNT_KEEP);
        ButtonOff(IDC_CNT_FILTER);
        TextClear(IDC_EDIT_FORMAT);
      end;
      ACT_SERVICE: begin
        TextClear(IDC_EDIT_SERVICE);
        TextClear(IDC_EDIT_WPAR);
        TextClear(IDC_EDIT_LPAR);
        EnableWindow(GetDlgItem(Dialog,IDC_EDIT_WPAR),true);
        EnableWindow(GetDlgItem(Dialog,IDC_EDIT_LPAR),true);
//        SendDlgItemMessage(Dialog,IDC_FLAG_WPAR,CB_SETCURSEL,0,0);
//        SendDlgItemMessage(Dialog,IDC_FLAG_LPAR,CB_SETCURSEL,0,0);
        CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_WPAR),ptNumber);
        CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_LPAR),ptNumber);

        CB_SelectData(GetDlgItem(Dialog,IDC_SRV_RESULT),sresInt);

        SendMessage(GetDlgItem(Dialog,IDC_EDIT_WPAR),CB_RESETCONTENT,0,0);
        SendMessage(GetDlgItem(Dialog,IDC_EDIT_LPAR),CB_RESETCONTENT,0,0);

        ButtonOff(IDC_RES_POPUP);
        ButtonOff(IDC_RES_MESSAGE);
        ButtonOff(IDC_RES_INSERT);

        ButtonOff(IDC_RES_FREEMEM);
        ButtonOff(IDC_RES_UNICODE);
        ButtonOff(IDC_RES_SIGNED);

        ButtonOff(IDC_SRV_WPAR);
        ButtonOff(IDC_SRV_LPAR);
        ButtonOff(IDC_SRV_SRVC);
      end;
      ACT_PROGRAM: begin
        TextClear(IDC_EDIT_PROCTIME);
        TextClear(IDC_EDIT_PRGPATH);
        TextClear(IDC_EDIT_PRGARGS);

        ButtonOff(IDC_FLAG_NORMAL);
        ButtonOff(IDC_FLAG_HIDDEN);
        ButtonOff(IDC_FLAG_MINIMIZE);
        ButtonOff(IDC_FLAG_MAXIMIZE);

        ButtonOff(IDC_FLAG_CURPATH);
        ButtonOff(IDC_FLAG_CONTINUE);
        ButtonOff(IDC_FLAG_PARALLEL);

        ButtonOff(IDC_PRG_PRG);
        ButtonOff(IDC_PRG_ARG);
      end;
      ACT_TEXT: begin
        ButtonOff(IDC_FLAG_CLIP);
        ButtonOff(IDC_FLAG_MESSAGE);
        ButtonOff(IDC_CLIP_COPYTO);
        ButtonOff(IDC_CLIP_PASTE);

        ButtonOff(IDC_FLAG_FILE);
        TextClear(IDC_FILE_PATH);
        ButtonOff(IDC_FILE_READ);
        ButtonOff(IDC_FILE_WRITE);
        ButtonOff(IDC_FILE_APPEND);
        
        EnableWindow(GetDlgItem(Dialog,IDC_EDIT_INSERT ),false);
        EnableWindow(GetDlgItem(Dialog,IDC_CLIP_COPYTO ),false);
        EnableWindow(GetDlgItem(Dialog,IDC_CLIP_PASTE  ),false);

        EnableWindow(GetDlgItem(Dialog,IDC_FILE_ENC    ),false);
        EnableWindow(GetDlgItem(Dialog,IDC_FILE_PATH   ),false);
        EnableWindow(GetDlgItem(Dialog,IDC_FILE_FILEBTN),false);
        EnableWindow(GetDlgItem(Dialog,IDC_FILE_READ   ),false);
        EnableWindow(GetDlgItem(Dialog,IDC_FILE_WRITE  ),false);
        EnableWindow(GetDlgItem(Dialog,IDC_FILE_APPEND ),false);

        TextClear(IDC_EDIT_INSERT);

        ButtonOff(IDC_TXT_FILE);
        ButtonOff(IDC_TXT_TEXT);
      end;
      ACT_ADVANCE: begin
        ButtonOff(IDC_FLAG_GT);
        ButtonOff(IDC_FLAG_LT);
        ButtonOff(IDC_FLAG_EQ);
        ButtonOff(IDC_FLAG_NOP);
        ButtonOff(IDC_FLAG_NOT);
        TextClear(IDC_ADV_VALUE);

        ButtonOff(IDC_FLAG_BREAK);
        ButtonOff(IDC_FLAG_JUMP);
        ButtonOff(IDC_FLAG_ANOP);
        EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL2),false);

        ButtonOff(IDC_FLAG_MATH);
        SendDlgItemMessage(Dialog,IDC_ADV_OPER,CB_SETCURSEL,0,0);
        TextClear(IDC_ADV_VAL1);
        ButtonOff(IDC_ADV_ASINT);

        EnableWindow(GetDlgItem(Dialog,IDC_ADV_OPER),false);
        EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL1),false);
        EnableWindow(GetDlgItem(Dialog,IDC_ADV_VARS),false);

        ButtonOff(IDC_FLAG_VARS);
        TextClear(IDC_ADV_VARS);
      end;
      ACT_CHAIN: begin
//        FillChainList(Dialog);
        SendDlgItemMessage(Dialog,IDC_GROUP_LIST,CB_SETCURSEL,0,0);
      end;
      ACT_RW: begin
        ButtonOff(IDC_RW_READ);
        ButtonOff(IDC_RW_WRITE);
        ButtonOff(IDC_RW_DELETE);
        SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_SETCURSEL,0,0);
        EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),true);
        TextClear(IDC_CONTACTLIST);
        TextClear(IDC_RW_MODULE);
        TextClear(IDC_RW_SETTING);
        TextClear(IDC_RW_VALUE);
        TextClear(IDC_RW_TEXT);

        ButtonOff(IDC_RW_CURRENT);
        ButtonOff(IDC_RW_PARAM);
        ButtonOff(IDC_RW_RESULT);
        ButtonOff(IDC_RW_MANUAL);
        ButtonOff(IDC_RW_LAST);

        ButtonOff(IDC_RW_MVAR);
        ButtonOff(IDC_RW_SVAR);
        ButtonOff(IDC_RW_TVAR);
      end;
      ACT_MESSAGE: begin
        TextClear(IDC_MSG_TITLE);
        TextClear(IDC_MSG_TEXT);
        ButtonOff(IDC_MSG_KEEP);
        ButtonOff(IDC_MSGB_OK);
        ButtonOff(IDC_MSGB_OC);
        ButtonOff(IDC_MSGB_ARI);
        ButtonOff(IDC_MSGB_YNC);
        ButtonOff(IDC_MSGB_YN);
        ButtonOff(IDC_MSGB_RC);
        ButtonOff(IDC_MSGI_NONE);
        ButtonOff(IDC_MSGI_ERROR);
        ButtonOff(IDC_MSGI_QUEST);
        ButtonOff(IDC_MSGI_WARN);
        ButtonOff(IDC_MSGI_INFO);

        ButtonOff(IDC_MSG_TTL);
        ButtonOff(IDC_MSG_TXT);
      end;
    end;
  end;

  procedure ClearDialogData;
  begin
    ClearControls(ACT_CONTACT);
    ClearControls(ACT_SERVICE);
    ClearControls(ACT_PROGRAM);
    ClearControls(ACT_TEXT);
    ClearControls(ACT_ADVANCE);
    ClearControls(ACT_CHAIN);
    ClearControls(ACT_RW);
    ClearControls(ACT_MESSAGE);
    mFreeMem(wstruct);
    mFreeMem(lstruct);
  end;

  procedure SHWindows(exclude:dword=0);
  begin
    SetupControls(ACT_CONTACT,SW_HIDE);
    SetupControls(ACT_SERVICE,SW_HIDE);
    SetupControls(ACT_PROGRAM,SW_HIDE);
    SetupControls(ACT_TEXT   ,SW_HIDE);
    SetupControls(ACT_ADVANCE,SW_HIDE);
    SetupControls(ACT_CHAIN  ,SW_HIDE);
    SetupControls(ACT_RW     ,SW_HIDE);
    SetupControls(ACT_MESSAGE,SW_HIDE);
{
    if exclude<>ACT_CONTACT then SetupControls(ACT_CONTACT,SW_HIDE);
    if exclude<>ACT_SERVICE then SetupControls(ACT_SERVICE,SW_HIDE);
    if exclude<>ACT_PROGRAM then SetupControls(ACT_PROGRAM,SW_HIDE);
    if exclude<>ACT_TEXT    then SetupControls(ACT_TEXT   ,SW_HIDE);
    if exclude<>ACT_ADVANCE then SetupControls(ACT_ADVANCE,SW_HIDE);
    if exclude<>ACT_CHAIN   then SetupControls(ACT_CHAIN  ,SW_HIDE);
    if exclude<>ACT_RW      then SetupControls(ACT_RW     ,SW_HIDE);
}
    case exclude of
      ACT_CONTACT,
      ACT_SERVICE,
      ACT_PROGRAM,
      ACT_TEXT   ,
      ACT_ADVANCE,
      ACT_CHAIN  ,
      ACT_RW     ,
      ACT_MESSAGE: begin
        SetupControls(exclude,SW_SHOW);
      end;
    end;
  end;

  procedure SHActButtons(mode:integer);
  begin
    ShowWindow(GetDlgItem(Dialog,IDC_STAT_ACTION),mode);
    ShowWindow(GetDlgItem(Dialog,IDC_ACTION_TYPE),mode);
  end;

  procedure InitDef(exclude:dword=0);
  begin
    if exclude<>ACT_CONTACT then
    begin
      ButtonOn(IDC_CNT_FILTER);
      // do nothing
    end;
    if exclude<>ACT_SERVICE then
    begin
      CB_SelectData(Dialog,IDC_SRV_RESULT,sresInt);
    end;
    if exclude<>ACT_PROGRAM then
    begin
      ButtonOn(IDC_FLAG_PARALLEL);
      ButtonOn(IDC_FLAG_NORMAL);
      SetDlgItemInt(Dialog,IDC_EDIT_PROCTIME,0,false);
    end;
    if exclude<>ACT_TEXT then
    begin
      ButtonOn(IDC_FLAG_CLIP);
      EnableWindow(GetDlgItem(Dialog,IDC_CLIP_COPYTO),true);
      EnableWindow(GetDlgItem(Dialog,IDC_CLIP_PASTE ),true);
      ButtonOn(IDC_CLIP_COPYTO);

      ButtonOn(IDC_FILE_READ);
      // do nothing
    end;
    if exclude<>ACT_ADVANCE then
    begin
      ButtonOn(IDC_FLAG_NOP);
      ButtonOn(IDC_FLAG_ANOP);
      SetDlgItemInt(Dialog,IDC_ADV_VALUE,0,false);
      SetDlgItemInt(Dialog,IDC_ADV_VAL1 ,0,false);
      EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL1),false);
      EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL2),false);
      EnableWindow(GetDlgItem(Dialog,IDC_ADV_OPER),false);
//      SendDlgItemMessage(Dialog,IDC_ADV_OPER,CB_SETCURSEL,0,0);
      CB_SelectData(Dialog,IDC_ADV_OPER,ORD(aeNot));
    end;
    if exclude<>ACT_CHAIN then
    begin
//      FillChainList(Dialog);
      SendDlgItemMessage(Dialog,IDC_GROUP_LIST,CB_SETCURSEL,0,0);
    end;
    if exclude<>ACT_RW then
    begin
      ButtonOn(IDC_RW_READ);
      SetDlgItemInt(Dialog,IDC_RW_VALUE,0,false);
      ButtonOn(IDC_RW_MANUAL);
      EnableWindow(GetDlgItem(Dialog,IDC_RW_VALUE),true);
      EnableWindow(GetDlgItem(Dialog,IDC_RW_TEXT ),true);
    end;
    if exclude<>ACT_MESSAGE then
    begin
      ButtonOn(IDC_MSGB_OK);
      ButtonOn(IDC_MSGI_NONE);
    end;
  end;

  // set buttons by options
  procedure FillAction(CurAction:integer);
  var
    i:integer;
    bb:boolean;
    wnd:HWND;
  begin
    with NewActionList^[CurAction] do
    begin
      if (flags and ACF_ASSIGNED)=0 then
        exit;
      if actionType=0 then
        actionType:=ACT_CONTACT;

      InitDef(actionType);
      SelectActionType(actionType);
      case actionType of

        ACT_CONTACT: begin
          if (flags and ACF_KEEPONLY)<>0 then
            ButtonOn(IDC_CNT_KEEP);
          if fCLfilter then
            ButtonOn(IDC_CNT_FILTER);
          SetDlgItemTextW(Dialog,IDC_EDIT_FORMAT,fCLformat);

          SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_SETCURSEL,
            FindContact(GetDlgItem(Dialog,IDC_CONTACTLIST),contact),0);
        end;

        ACT_SERVICE: begin
          if SendDlgItemMessageA(Dialog,IDC_EDIT_SERVICE,CB_SELECTSTRING,twparam(-1),tlparam(service))<>CB_ERR then
            ReloadService
          else
            SetDlgItemTextA(Dialog,IDC_EDIT_SERVICE,service);

          if (flags2 and ACF2_SRV_WPAR)<>0 then ButtonOn(IDC_SRV_WPAR);
          if (flags2 and ACF2_SRV_LPAR)<>0 then ButtonOn(IDC_SRV_LPAR);
          if (flags2 and ACF2_SRV_SRVC)<>0 then ButtonOn(IDC_SRV_SRVC);

          if (flags and ACF_MESSAGE)<>0 then ButtonOn(IDC_RES_MESSAGE);
          if (flags and ACF_POPUP  )<>0 then ButtonOn(IDC_RES_POPUP);
          if (flags and ACF_INSERT )<>0 then ButtonOn(IDC_RES_INSERT);

          if (flags and ACF_HEX)<>0 then
            i:=sresHex
          else if (flags and ACF_STRUCT)<>0 then
            i:=sresStruct
          else if (flags and ACF_STRING)<>0 then
          begin
            i:=sresString;
            if (flags  and ACF_UNICODE )<>0 then ButtonOn(IDC_RES_UNICODE);
            if (flags2 and ACF2_FREEMEM)<>0 then ButtonOn(IDC_RES_FREEMEM);
          end
          else
          begin
            i:=sresInt;
            if (flags and ACF_SIGNED)<>0 then
              ButtonOn(IDC_RES_SIGNED);
          end;
          CB_SelectData(Dialog,IDC_SRV_RESULT,i);

          if (flags and ACF_WPARAM)<>0 then
          begin
            EnableWindow(GetDlgItem(Dialog,IDC_EDIT_WPAR),false);
            i:=ptParam;
          end
          else if (flags and ACF_WRESULT)<>0 then
          begin
            EnableWindow(GetDlgItem(Dialog,IDC_EDIT_WPAR),false);
            i:=ptResult;
          end
          else if (flags and ACF_WPARNUM)<>0 then
          begin
            if (flags and ACF_WCURRENT)<>0 then
            begin
              EnableWindow(GetDlgItem(Dialog,IDC_EDIT_WPAR),false);
              i:=ptCurrent
            end
            else
            begin
              i:=ptNumber;
              SetNumValue(GetDlgItem(Dialog,IDC_EDIT_WPAR),wparam,
                  (flags2 and ACF2_SRV_WPAR)<>0,
                  (flags2 and ACF2_SRV_WHEX)<>0);
//              SetDlgItemInt(Dialog,IDC_EDIT_WPAR,wparam,true)
            end;
          end
          else if (flags and ACF_WSTRUCT)<>0 then
          begin
            i:=ptStruct;
            SHControl(IDC_EDIT_WPAR,SW_HIDE);
            SHControl(IDC_WSTRUCT  ,SW_SHOW);
            mFreeMem(wstruct);
            StrDup(wstruct,PAnsiChar(wparam));
          end
          else if (flags and ACF_WUNICODE)<>0 then
          begin
            i:=ptUnicode;
            SetDlgItemTextW(Dialog,IDC_EDIT_WPAR,pWideChar(wparam));
          end
          else
          begin
            i:=ptString;
            SetDlgItemTextA(Dialog,IDC_EDIT_WPAR,PAnsiChar(wparam));
          end;
          CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_WPAR),i);
          SendDlgItemMessage(Dialog,IDC_FLAG_WPAR,CB_SETCURSEL,i,0);

          if (flags and ACF_LPARAM)<>0 then
          begin
            EnableWindow(GetDlgItem(Dialog,IDC_EDIT_LPAR),false);
            i:=ptParam;
          end
          else if (flags and ACF_LRESULT)<>0 then
          begin
            EnableWindow(GetDlgItem(Dialog,IDC_EDIT_LPAR),false);
            i:=ptResult;
          end
          else if (flags and ACF_LPARNUM)<>0 then
          begin
            if (flags and ACF_LCURRENT)<>0 then
            begin
              EnableWindow(GetDlgItem(Dialog,IDC_EDIT_LPAR),false);
              i:=ptCurrent;
            end
            else
            begin
              i:=ptNumber;
              SetNumValue(GetDlgItem(Dialog,IDC_EDIT_LPAR),lparam,
                  (flags2 and ACF2_SRV_LPAR)<>0,
                  (flags2 and ACF2_SRV_LHEX)<>0);
//              SetDlgItemInt(Dialog,IDC_EDIT_LPAR,lparam,true)
            end;
          end
          else if (flags and ACF_LSTRUCT)<>0 then
          begin
            i:=ptStruct;
            SHControl(IDC_EDIT_LPAR,SW_HIDE);
            SHControl(IDC_LSTRUCT  ,SW_SHOW);
            mFreeMem(lstruct);
            StrDup(lstruct,PAnsiChar(lparam));
          end
          else if (flags and ACF_LUNICODE)<>0 then
          begin
            i:=ptUnicode;
            SetDlgItemTextW(Dialog,IDC_EDIT_LPAR,pWideChar(lparam));
          end
          else
          begin
            i:=ptString;
            SetDlgItemTextA(Dialog,IDC_EDIT_LPAR,PAnsiChar(lparam));
          end;
          CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_LPAR),i);

        end;

        ACT_PROGRAM: begin
          if (flags2 and ACF2_PRG_PRG)<>0 then
            ButtonOn(IDC_PRG_PRG);
          if (flags2 and ACF2_PRG_ARG)<>0 then
            ButtonOn(IDC_PRG_ARG);

          SetDlgItemTextW(Dialog,IDC_EDIT_PRGPATH ,prgname);
          SetDlgItemTextW(Dialog,IDC_EDIT_PRGARGS ,args);
          SetDlgItemInt  (Dialog,IDC_EDIT_PROCTIME,time,false);
          case show of
            SW_HIDE         : ButtonOn(IDC_FLAG_HIDDEN);
            SW_SHOWMINIMIZED: ButtonOn(IDC_FLAG_MINIMIZE);
            SW_SHOWMAXIMIZED: ButtonOn(IDC_FLAG_MAXIMIZE);
          else
            {SW_SHOWNORMAL   :} ButtonOn(IDC_FLAG_NORMAL);
          end;
          if (flags and ACF_CURPATH)<>0 then
            ButtonOn(IDC_FLAG_CURPATH);
          if (flags and ACF_PRTHREAD)<>0 then
            ButtonOn(IDC_FLAG_PARALLEL)
          else
            ButtonOn(IDC_FLAG_CONTINUE);

        end;

        ACT_TEXT: begin
          if (flags and ACF_CLIPBRD)<>0 then
          begin
            ButtonOn(IDC_FLAG_CLIP);
            EnableWindow(GetDlgItem(Dialog,IDC_CLIP_COPYTO),true);
            EnableWindow(GetDlgItem(Dialog,IDC_CLIP_PASTE ),true);
            if (flags and ACF_COPYTO)<>0 then
              ButtonOn(IDC_CLIP_COPYTO)
            else
              ButtonOn(IDC_CLIP_PASTE);
// for switches
            ButtonOn(IDC_FILE_READ);
          end

          else
          begin
            if (flags and (ACF_FILE or ACF_FAPPEND or ACF_FWRITE))<>ACF_FILE then
              EnableWindow(GetDlgItem(Dialog,IDC_EDIT_INSERT),true);
            SetDlgItemTextW(Dialog,IDC_EDIT_INSERT,text);
// for switches
            ButtonOn(IDC_CLIP_COPYTO);

            if (flags2 and ACF2_TXT_TEXT)<>0 then
              ButtonOn(IDC_TXT_TEXT);

            if (flags and ACF_FILE)<>0 then
            begin
              if (flags2 and ACF2_TXT_FILE)<>0 then
                ButtonOn(IDC_TXT_FILE);
              ButtonOn(IDC_FLAG_FILE);
              EnableWindow(GetDlgItem(Dialog,IDC_FILE_PATH   ),true);
              EnableWindow(GetDlgItem(Dialog,IDC_FILE_FILEBTN),true);
              EnableWindow(GetDlgItem(Dialog,IDC_FILE_READ   ),true);
              EnableWindow(GetDlgItem(Dialog,IDC_FILE_WRITE  ),true);
              EnableWindow(GetDlgItem(Dialog,IDC_FILE_APPEND ),true);

              wnd:=GetDlgItem(Dialog,IDC_FILE_ENC);
              EnableWindow(wnd,true);
              if (flags and ACF_ANSI)<>0 then
                CB_SelectData(wnd,0)
              else if (flags and ACF_UTF8)<>0 then
              begin
                if (flags and ACF_SIGN)<>0 then
                  CB_SelectData(wnd,2)
                else
                  CB_SelectData(wnd,1);
              end
              else if (flags and ACF_SIGN)<>0 then
                CB_SelectData(wnd,4)
              else
                CB_SelectData(wnd,3);

              if      (flags and ACF_FAPPEND)<>0 then ButtonOn(IDC_FILE_APPEND)
              else if (flags and ACF_FWRITE )<>0 then ButtonOn(IDC_FILE_WRITE)
              else ButtonOn(IDC_FILE_READ);
              SetDlgItemTextW(Dialog,IDC_FILE_PATH,tfile);
            end
            else
            begin
              ButtonOn(IDC_FLAG_MESSAGE);
// for switches
              ButtonOn(IDC_FILE_READ);
            end;
          end;

        end;

        ACT_ADVANCE: begin
          FillSubList(Dialog);
//          SendDlgItemMessage(Dialog,IDC_ADV_VAL2,CB_SETCURSEL,0,0);

          case condition and not ADV_COND_NOT of
            ADV_COND_GT: ButtonOn(IDC_FLAG_GT);
            ADV_COND_LT: ButtonOn(IDC_FLAG_LT);
            ADV_COND_EQ: ButtonOn(IDC_FLAG_EQ);
          else // ADV_COND_NOP
            ButtonOn(IDC_FLAG_NOP);
          end;
          SetDlgItemInt(Dialog,IDC_ADV_VALUE,value,false);
          if (condition and ADV_COND_NOT)<>0 then
            ButtonOn(IDC_FLAG_NOT);

          SetDlgItemInt(Dialog,IDC_ADV_VAL1,mathval,true);
          case action and ADV_ACTION of
            ADV_ACT_MATH: begin
              ButtonOn(IDC_FLAG_MATH);
              CB_SelectData(GetDlgItem(Dialog,IDC_ADV_OPER),oper);
//              SendDlgItemMessage(Dialog,IDC_ADV_OPER,CB_SETCURSEL,oper,0);
              EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL1),true);
              EnableWindow(GetDlgItem(Dialog,IDC_ADV_OPER),true);
            end;
            ADV_ACT_VARS: begin
              ButtonOn(IDC_FLAG_VARS);
              if (flags and ACF_VARASINT)<>0 then
                ButtonOn(IDC_ADV_ASINT);
              EnableWindow(GetDlgItem(Dialog,IDC_ADV_VARS),true);
              SetDlgItemTextW(Dialog,IDC_ADV_VARS,varval);
            end;
          end;
          bb:=false;
          case action and ADV_ACT_POST of
            ADV_ACT_BREAK: ButtonOn(IDC_FLAG_BREAK);
            ADV_ACT_JUMP : begin
              SendDlgItemMessageW(Dialog,IDC_ADV_VAL2,CB_SELECTSTRING,twparam(-1),tlparam(operval));
              ButtonOn(IDC_FLAG_JUMP);
              bb:=true;
            end;
          else // ADV_ACT_NOP
            ButtonOn(IDC_FLAG_ANOP);
          end;
          EnableWindow(GetDlgItem(Dialog,IDC_ADV_VAL2),bb);
        end;

        ACT_CHAIN: begin
//          FillChainList(Dialog);
          if (flags and ACF_BYNAME)<>0 then
            SendDlgItemMessageW(Dialog,IDC_GROUP_LIST,CB_SELECTSTRING,twparam(-1),tlparam(actname))
          else
            SendDlgItemMessageW(Dialog,IDC_GROUP_LIST,CB_SELECTSTRING,twparam(-1),tlparam(GetGroupName(id)));
        end;

        ACT_RW: begin
          if      (flags and ACF_DBDELETE)<>0 then ButtonOn(IDC_RW_DELETE)
          else if (flags and ACF_DBWRITE )= 0 then ButtonOn(IDC_RW_READ)
          else                                     ButtonOn(IDC_RW_WRITE);

          bb:=false;
          if (flags and ACF_CURRENT)<>0 then
          begin
            ButtonOn(IDC_RW_CURRENT);
            EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),false);
          end
          else if (flags and ACF_PARAM)<>0 then
          begin
            ButtonOn(IDC_RW_PARAM);
            EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),false);
          end
          else if (flags and ACF_RESULT)<>0 then
          begin
            ButtonOn(IDC_RW_RESULT);
            EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),false);
          end
          else
          begin
            ButtonOn(IDC_RW_MANUAL);
            bb:=true;
            EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),true);
            SendDlgItemMessage(Dialog,IDC_CONTACTLIST,CB_SETCURSEL,
              FindContact(GetDlgItem(Dialog,IDC_CONTACTLIST),dbcontact),0);
          end;
          EnableWindow(GetDlgItem(Dialog,IDC_CONTACTLIST),bb);

          if (flags and ACF_LAST)<>0 then
          begin
            ButtonOn(IDC_RW_LAST);
            bb:=false;
          end
          else
            bb:=true;
          if (flags and ACF_DBDELETE)<>0 then
            bb:=false;

          EnableWindow(GetDlgItem(Dialog,IDC_RW_VALUE),bb);
          EnableWindow(GetDlgItem(Dialog,IDC_RW_TEXT ),bb);

          SetDlgItemTextA(Dialog,IDC_RW_MODULE ,dbmodule);
          SetDlgItemTextA(Dialog,IDC_RW_SETTING,dbsetting);
          if (flags2 and ACF2_RW_MVAR)<>0 then ButtonOn(IDC_RW_MVAR);
          if (flags2 and ACF2_RW_SVAR)<>0 then ButtonOn(IDC_RW_SVAR);
          if (flags2 and ACF2_RW_TVAR)<>0 then ButtonOn(IDC_RW_TVAR);


          wnd:=GetDlgItem(Dialog,IDC_RW_DATATYPE);
          if ((flags and ACF_DBANSI )=ACF_DBANSI) or
             ((flags and ACF_DBUTEXT)=ACF_DBUTEXT) then
          begin
            SHControl(IDC_RW_TEXT ,SW_SHOW);
            SHControl(IDC_RW_VALUE,SW_HIDE);
            if (flags and ACF_DBANSI)=ACF_DBANSI then
              CB_SelectData(wnd,3)
            else
              CB_SelectData(wnd,4);
            SetDlgItemTextW(Dialog,IDC_RW_TEXT,pWideChar(dbvalue));
          end
          else
          begin
            if (flags and ACF_DBBYTE)=ACF_DBBYTE then
              CB_SelectData(wnd,0)
            else if (flags and ACF_DBWORD)=ACF_DBWORD then
              CB_SelectData(wnd,1)
            else
              CB_SelectData(wnd,2);
            SHControl(IDC_RW_TEXT ,SW_HIDE);
            SHControl(IDC_RW_VALUE,SW_SHOW);

            SetNumValue(GetDlgItem(Dialog,IDC_RW_VALUE),dbvalue,
                (flags2 and ACF2_RW_TVAR)<>0,
                (flags2 and ACF2_RW_HEX )<>0);
          end;

        end;

        ACT_MESSAGE: begin
          SetDlgItemTextW(Dialog,IDC_MSG_TITLE,msgtitle);
          SetDlgItemTextW(Dialog,IDC_MSG_TEXT ,msgtext);
          if (flags2 and ACF2_MSG_TTL)<>0 then ButtonOn(IDC_MSG_TTL);
          if (flags2 and ACF2_MSG_TXT)<>0 then ButtonOn(IDC_MSG_TXT);
          if (flags  and ACF_MSG_KEEP)<>0 then ButtonOn(IDC_MSG_KEEP);

          case boxopts and $0F of
            1: ButtonOn(IDC_MSGB_OC);
            2: ButtonOn(IDC_MSGB_ARI);
            3: ButtonOn(IDC_MSGB_YNC);
            4: ButtonOn(IDC_MSGB_YN);
            5: ButtonOn(IDC_MSGB_RC);
          else
            ButtonOn(IDC_MSGB_OK);
          end;
          case boxopts and $F0 of
            $10: ButtonOn(IDC_MSGI_ERROR);
            $20: ButtonOn(IDC_MSGI_QUEST);
            $30: ButtonOn(IDC_MSGI_WARN);
            $40: ButtonOn(IDC_MSGI_INFO);
          else
            ButtonOn(IDC_MSGI_NONE);
          end;
        end;
      end;
      SHWindows(actionType);
    end;
  end;