Mac OS X Programming读书笔记5 - Controls

book:记录自己的学习:开源项目、知识脉络、读书笔记 目录 一、书籍 计算机网络 《图解http》 GC回收 《垃圾回收的算法和实现》 二、其他 Markdown写作 我的互联网付费 与人交流 三、工具 VSCode插件 snipaste 开发环境 git mac 工具 adb ffmpeg: http://naotu.baidu.com/file/59a6fa3446a1b17ae96f1ec62560fa7d?token=cb4ca26ad9b4b980 当前计划 已完成计划 序号 计划名字 当前进度 资源链接 结论 结束时间 1 《谷歌方法论》 2 《垃圾回收的算法和实现》 3 《Objective-C基础教程》 pdf 已购 了解语法,细节和进阶需后续再学习 短期计划(优先级高) 序号 计划名字 当前进度 资源链接 结论 结束时间 1 长期计划(优先级中 书籍课程): 序号 计划名字 当前进度 资源链接 结论 1 《Shader入门 立即下载

Chapter 5 Controls

1 Command Signatures and Control IDs

1.     可以将Command和Control联系起来,但是当你收到事件的时候,你并不知道当时是哪个Control被按下了。事实上,你也不需要关心,因为Command本来被设计成代表命令,至于是点击Button还是选择菜单都没有关系

2.     当你需要知道Control究竟发生了什么事情的时候,你需要给Control分配一个Control ID,包括:

a.     Signature:一个4个Char的标记,一般来说应该是程序的Creator Code,也就是Application本身的Signature。大部分情况下,单一程序的所有Control ID的Signature都是一样的

b.     ID:一个整数,真正的独立在此程序中标记该Control的ID

2 Buttons

1.     Bevel Button

2.     ImageWell

3 Radio Buttons

系统负责维护Radio Button的状态,不需要自己编程处理。

1: ControlHandle numBeepsRadioButtonGroup;

2: ControlID numBeepsControlID = { kControlSignature, kRadioGroupControlID };

 

3: GetControlByID( window, &numBeepsControlID,

       &numBeepsRadioButtonGroup );

 

SInt32 numBeepsValue;

4: numBeepsValue = GetControl32BitValue( numBeepsRadioButtonGroup );

1.     声明一个Control的Handle

2.     声明Control的Control  ID,也就是这个Radio Button Group的ID

3.     通过Control ID获得Control的Handle

4.     通过Handle获得Control的32-bit整数值,表示哪一个Radio Button被按下了

4 Checkboxes

和上面的非常类似,GetControl32BitValue返回0说明没有Check,1则为Checked

5 Text Input Fields

应该使用GetcontrolData来获得Text Input Fields所对应的字符串:

OSErr GetControlData(

       ControlRef inControl,

       ControlPartCode inPart,

       ResType inTagName,

       Size inBufferSize,

       void * inBuffer,

       Size * outActualSize );

1.     ControlRef inControl:ControlRef也就是ControlHandle,所以直接传递用GetControlByID的返回值即可

2.     ControlPartCode inPart:指定访问Control的哪一部分,部分Control由多个Control组成,由不同的常量代表不同的子控件。如果没有子控件,可以传递kControlEntireControl代表整个控件本身

3.     ResType inTagName:数据的类型,对于Text Input Field应该传递kControlEditTextCFStringTag

4.     Size inBufferSize:缓冲区大小

5.     Void *inBuffer:缓冲区本身

6.     Size *outActualSize:实际大小

举例如下:

CFStringRef theString;

 

GetControlData(

       stringInTextEdit,

       kControlEntireControl,

       kControlEditTextCFStringTag,

       sizeof( CFStringRef ),

       &theString,

       NULL );

 

同样的,可以用SetControlData来设置Text Input Field的字符串:

OSErr SetControlData(

       ControlRef inControl,

       ControlPartCode inPart,

       ResType inTagName,

       Size inSize,

       void * inData);

 

 
HALCON深度学习模型部署新选择:一份详细的OpenVINO 2021.4 LTS集成与配置避坑指南 本文详细介绍了如何将HALCON深度学习模型与OpenVINO 2021.4 LTS集成,提供环境配置、硬件加速优化及故障排除的实用指南。特别针对Intel独立显卡的AI加速器接口进行优化,帮助机器视觉工程师提升AI推理效率,适用于工业检测等高要求场景。 阅读详情

相关推荐

【 史上最全】测绘、遥感RS、地信GIS国家级比赛竞赛整理

目录Esri Esri

weixin_43910227的博客 9150

30天自制操作系统(Mac版)读书笔记(day6)

这里可以理解成两个线程,一个是主程序的主线程,一个是事件线程,但实际上并没有分开线程,只是打个比方。在这里,主线程中读取队列中的数据,事件回掉负责写入数据。

Niap的博客 609

vasp和ms_武汉理工大学赵焱课题组开发脚本 MS建模一键获取VASP输入文件POSCAR

本文给大家推介并分享一个通过Materials Studio一键获取VASP输入文件POSCAR的脚本,xsd2pos.pl。此脚本是武汉理工大学首席教授赵焱在帮助学生解决VASP计算问题时编写,解决了其他间接非手动获取POSCAR存在的问题,同时也相较于其他方法更为便捷,相信会对从事VASP计算的同行们带来便利。赵焱老师怀着哺育天下学子的情怀,希望给大家分享一下。下文介绍一下它的使用方法以及它所...

weixin_39706367的博客 2286

[macOS]radio button

新版本中,radio group不再提供,那么如何使用radio button呢? 先拖三个radio button到面板里,并分别设置它们的tag: 打开辅助编辑模式,ctrl拖拽一个Action,注意:三个button的Action拖到一个Action! @IBAction func radioBtnClicked(sender: AnyObject) { ...

weixin_30702887的博客 231

RK3588内核崩溃日志捕获:pstore与ramoops的实战配置指南

本文详细介绍了在RK3588嵌入式设备上配置pstore与ramoops以捕获内核崩溃日志的实战指南。通过内核配置调整、设备树设置及高级调试技巧,帮助开发者有效定位系统崩溃原因,特别适合户外智能设备等无法长期连接调试器的场景。文章还提供了生产环境优化建议,确保日志捕获的可靠性与安全性。

weixin_29189363的博客 407

保姆级教程:STK 11.0 从下载到安装成功(附Matlab互联配置与常见问题解决)

本文提供STK 11.0的完整安装指南,包括下载、安装步骤、Matlab互联配置及常见问题解决方案。详细介绍了系统要求核查、分步安装流程、关键文件替换和许可证配置,确保用户能够顺利完成STK 11.0的部署并实现与Matlab的无缝对接。

weixin_30698297的博客 344

WPF中button样式定义

转自 http://www.silverlightchina.net/html/study/WPF/2011/1008/10806.html

700

CentOS 7下glibc升级到2.28的保姆级避坑指南(含GCC 7.3.1编译配置)

本文详细介绍了在CentOS 7系统中将glibc升级到2.28版本的完整流程,包括GCC 7.3.1的编译配置、环境变量设置、glibc编译的细节处理以及生产环境验证。文章特别强调了风险控制和避坑技巧,适用于需要提升系统兼容性的企业级用户。

weixin_29611239的博客 408

凹凸按钮样式

.function-block a.disabled-link { background-color: #456686; box-shadow: inset 0px 2px 8px 2px #292929; cursor: default; } .function-block { min-width: 130px; float: left; background-color: #ff

samete的专栏 1545

从符号到基元:Token的技术演化史与“词元”汉化的术语学

中文摘要:Token概念演化与"词元"译名的确立 本文系统梳理了"Token"概念从信息论符号到AI基元的完整演化史,揭示了"词元"这一中文译名确立的必然性。概念发展经历了三个阶段:早期作为编译原理中的词法单元(1960s),统计NLP时期作为概率空间的原子(1990s-2000s),以及神经时代成为动态语义载体(2010s后)。随着Transformer架构兴起,Token从静态符号转变为上下文相关的语义基元,其定义彻底突破"词&quo

AllenLV的博客 1221

《Autosar从入门到精通-实战篇》总目录_培训教程持续更新中...

欢迎大家订阅《Autosar从入门到精通-实战篇》,下方整理了相关博文的目录(单击蓝色字体即可跳转),方便大家获取。 本专栏旨在:扫除Autosar工具链配置过程中的障碍,加深对Autosar理论的理解。 温馨提醒: 如有疑问,可在博文的“评论区”给小编留言,进行技术交流(评论区开启了验证功能,审核通过后,会显示); 如有疑问,也可以通过博文中的第一个图片联系小编,获取专栏/博文的实时状态; 由于工作限制,仅做个人技术交流。添加好友时,请备注您的“姓名-公司-职务...

「汽车电子助手」的博客 12万+

Mac OS X Programming读书笔记1 - 系统架构

Chapter 1 System Components and Programming Technologies1.    Mac OS X IntroductionMac OS X是Apple最新一代的操作系统,基于UNIX,最显著的特点是有着极其漂亮的界面,称之为Aqua:2.    Mac OS X ArchitectureMac OS X的架构图:2

张羿的优快云专栏 8244

基于STM32、HAL库的WF282A气压传感器 驱动程序设计

测量范围:0-2.5MPa(可根据需求选择其他量程)输出方式:I2C或SPI数字接口。温度补偿范围:-20℃~85℃。低功耗设计,适合电池供电应用。工作电压:3.3V/5V。精度:±0.1%FS。

corlin6688的博客 394

Mac OS X Programming读书笔记2 - HelloWorld

 Chapter 2 Overview of Mac OS X Programming1 Programming Environments1.     Metrowerks CodeWarrior,Metrowerks开发的IDE,跨平台,支持多种语言,如C,C++,Object Pascal,Java,Objective-C2.     Project Builder,Apple

张羿的优快云专栏 4031

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

第二章 X Programming 的第一步

Index:基本步骤 建立一个 display至 X Server 取得 display的相关资料 建立视窗 和视窗管理程式(Window Manager)沟通 显示视窗 关闭(destroy)视窗 关闭 display 例 --------------------------------------------------------------------------------一个 X 的程式的几个基本步骤: main() {        建立一个 display 至 X Server;     

ly7969的专栏 922

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

macOS 控件教程(2)

原文:macOS Controls Tutorial: Part 2/2 作者:Ernesto García 译者:kmyhy 更新说明:由 Ernesto García 升级至 Xcode 8.2/Swift 3。上一版本由 Michael Briscoe 升级至 Xcode 6.3/Swift 1.2。原文作者是 Ernesto García。 欢迎回到 macOS 控件教

kmyhy的专栏 3370

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Mac 使用感受以及一些技巧、工具推荐

写在前面, Mac 使用感受,纯粹的个人偏见,看官大可直接跳到下面的工具推荐阅读。 17年底,鄙人跳槽进入一家互联网金融公司,公司配备的笔记本是16年款 MacBook Pro,8G。对于之前只使用 Windows 系统和开发环境的我来说,很是高大上。犹记得工作第一天,领到笔记本时,还在纳闷,怎么没有鼠标啊?然后还手机百度 Mac 手势操作大全。哈哈,真实光辉历史。使用2个星期,基本上熟悉手势,...

lonelymanontheway的博客 2万+

【读书笔记】提高编码效率 —— 《Mac 高效开发指南》

文章目录Mac 系统配置快捷键进阶光标移动使用 Option 键拓展预览程序qlcolorcode用好 F1-F12完全键盘控制邮件规则iTerm2光标移动选择文本VimVS Code其他 注:本文绝大部分内容引自《Mac 高效开发指南》,本文仅为自己学习用,全部内容请见原著。 Mac 系统配置 快捷键进阶 光标移动 这里比较推荐使用 Emacs 系的快捷键而不是传统的 Command + ←/→...

1926

RadioButton控件和CheckBox控件介绍

1.单选按钮RadioButton控件    在同一个容器中,比如Form,Panel,GroupBox,PictureBox中存在两个以上单选按钮时,只能选择一个,但在不同的容器中几组单选按钮彼此不关联2.复选按钮CheckBox控件    允许用户选择和清除关联选项3.常用的属性和事件    两者基本是一致的    属性:Checked:一个布尔值,如果被选中则为True,否则为False  ...

ClearLoveQ的博客 3830

基本控件RadioButton控件

圆形控件:一般用于单选,放在一起的多个RadioButton控件默认是互斥的。 使用RadioButton分组有两种方式: 一、把这些分组装到不同的容器里; 二、设置它们的GroupName属性; 转载于:https://blog.51cto.com/6685704/1167626...

weixin_33695450的博客 257

MacOS开发(OC)----NSButton类相关属性跟方法

一、NSButton的常用属性 NSButton相关属性设置 NSButton* button = [[NSButton alloc]init]; button.frame = NSMakeRect(400, 200, 50, 20); //设置按钮名称 button.title = @"HELLOW"; //设...

代码行者-音频技术开发 2766

MacTalk读书笔记

很多人问我如何找到一份长期稳定的工作时,如何开启一个能够带来巨大成功的项目时,我只能说,最初的想法,并不是一切,开始去做就好了。

pvting的博客 450

让你的mac更具效率,三个mac上好用的笔记软件

笔记软件有很多,特别是mac上,优秀的笔记软件比windows上更多。主流的笔记软件比如印象笔记,有道云笔记,为知笔记,这几个笔记软件在各个平台都有,也比较通用,我来说说几个比较在mac上特有的比较好用的笔记软件。 onenote:用于记录课堂笔记和手写笔记 OneNote是微软的笔记软件,作为office办公软件的一员,很多在安装office办公软件的人都会把OneNote装上,但是很多人...

PS学习社 2万+
上一篇: Visual Studio 2005 SP1 Update for Windows Vista发布了
下一篇: 使用pthread库进行多线程编程2 - UNIX高级环境编程第12章读书笔记
ATField
博客等级 码龄25年 673粉丝 119原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值